Extract a string array from a `regorus::Value` object field.
(val: ®orus::Value, key: &str)
| 668 | |
| 669 | /// Extract a string array from a `regorus::Value` object field. |
| 670 | fn get_str_array(val: ®orus::Value, key: &str) -> Vec<String> { |
| 671 | let key_val = regorus::Value::String(key.into()); |
| 672 | match val { |
| 673 | regorus::Value::Object(map) => match map.get(&key_val) { |
| 674 | Some(regorus::Value::Array(arr)) => arr |
| 675 | .iter() |
| 676 | .filter_map(|v| { |
| 677 | if let regorus::Value::String(s) = v { |
| 678 | Some(s.to_string()) |
| 679 | } else { |
| 680 | None |
| 681 | } |
| 682 | }) |
| 683 | .collect(), |
| 684 | _ => vec![], |
| 685 | }, |
| 686 | _ => vec![], |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | fn parse_filesystem_policy(val: ®orus::Value) -> FilesystemPolicy { |
| 691 | FilesystemPolicy { |
no test coverage detected