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

Function get_str

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

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

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

Source from the content-addressed store, hash-verified

644
645/// Extract a string from a `regorus::Value` object field.
646fn get_str(val: &regorus::Value, key: &str) -> Option<String> {
647 let key_val = regorus::Value::String(key.into());
648 match val {
649 regorus::Value::Object(map) => match map.get(&key_val) {
650 Some(regorus::Value::String(s)) => Some(s.to_string()),
651 _ => None,
652 },
653 _ => None,
654 }
655}
656
657/// Extract a bool from a `regorus::Value` object field.
658fn get_bool(val: &regorus::Value, key: &str) -> Option<bool> {

Callers 2

parse_landlock_policyFunction · 0.85
parse_process_policyFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected