MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / get_str_array

Function get_str_array

crates/openshell-supervisor-network/src/opa.rs:670–688  ·  view source on GitHub ↗

Extract a string array from a `regorus::Value` object field.

(val: &regorus::Value, key: &str)

Source from the content-addressed store, hash-verified

668
669/// Extract a string array from a `regorus::Value` object field.
670fn get_str_array(val: &regorus::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
690fn parse_filesystem_policy(val: &regorus::Value) -> FilesystemPolicy {
691 FilesystemPolicy {

Callers 2

query_allowed_ipsMethod · 0.85
parse_filesystem_policyFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected