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

Function extract_bool_setting

crates/openshell-sandbox/src/lib.rs:1870–1883  ·  view source on GitHub ↗

Extract a bool value from an effective setting, if present.

(
    settings: &std::collections::HashMap<String, openshell_core::proto::EffectiveSetting>,
    key: &str,
)

Source from the content-addressed store, hash-verified

1868
1869/// Extract a bool value from an effective setting, if present.
1870fn extract_bool_setting(
1871 settings: &std::collections::HashMap<String, openshell_core::proto::EffectiveSetting>,
1872 key: &str,
1873) -> Option<bool> {
1874 use openshell_core::proto::setting_value;
1875 settings
1876 .get(key)
1877 .and_then(|es| es.value.as_ref())
1878 .and_then(|sv| sv.value.as_ref())
1879 .and_then(|v| match v {
1880 setting_value::Value::BoolValue(b) => Some(*b),
1881 _ => None,
1882 })
1883}
1884
1885/// Log individual setting changes between two snapshots.
1886fn log_setting_changes(

Callers 2

run_policy_poll_loopFunction · 0.85
apply_ocsf_json_settingFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected