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

Function get_object_bool

crates/openshell-supervisor-network/src/l7/mod.rs:310–319  ·  view source on GitHub ↗

Extract a bool value from a regorus object. Returns `None` when the key is absent or not a boolean.

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

Source from the content-addressed store, hash-verified

308/// Extract a bool value from a regorus object. Returns `None` when the key
309/// is absent or not a boolean.
310fn get_object_bool(val: &regorus::Value, key: &str) -> Option<bool> {
311 let key_val = regorus::Value::String(key.into());
312 match val {
313 regorus::Value::Object(map) => match map.get(&key_val) {
314 Some(regorus::Value::Bool(b)) => Some(*b),
315 _ => None,
316 },
317 _ => None,
318 }
319}
320
321fn get_object_u64(val: &regorus::Value, key: &str) -> Option<u64> {
322 let key_val = regorus::Value::String(key.into());

Callers 1

parse_l7_configFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected