pub trait TriboolExt<T> {
// Required methods
fn define(&self, default: Option<T>) -> Option<T>
where T: Clone;
fn apply_to_json(&self, obj: &mut Map<String, JsonValue>, key: &str) -> bool
where T: Into<JsonValue> + Clone;
fn apply_to_json_value(&self, obj: &mut JsonValue, key: &str) -> bool
where T: Into<JsonValue> + Clone;
}Expand description
Extension trait for Option
Required Methods§
Sourcefn define(&self, default: Option<T>) -> Option<T>where
T: Clone,
fn define(&self, default: Option<T>) -> Option<T>where
T: Clone,
Define a value if the current value is None (undefined)
Similar to the tribool.define() function in C++, this method will set the value to the provided default only if the current value is None.
§Arguments
default- The value to use if self is None
§Returns
The existing value if Some, otherwise the default value