Extract a bool value from an effective setting, if present.
(
settings: &std::collections::HashMap<String, openshell_core::proto::EffectiveSetting>,
key: &str,
)
| 1868 | |
| 1869 | /// Extract a bool value from an effective setting, if present. |
| 1870 | fn 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. |
| 1886 | fn log_setting_changes( |
no test coverage detected