pub trait AccessorTrait<R, V, Root, Value, MutRoot, MutValue, G, S> {
// Required methods
fn get_optional(&self, root: Option<Root>) -> Option<Value>;
fn get_mut_optional(&self, root: Option<MutRoot>) -> Option<MutValue>;
fn get_or_else<F>(&self, root: Root, f: F) -> Value
where F: FnOnce() -> Value;
fn get_mut_or_else<F>(&self, root: MutRoot, f: F) -> MutValue
where F: FnOnce() -> MutValue;
}Required Methods§
Sourcefn get_optional(&self, root: Option<Root>) -> Option<Value>
fn get_optional(&self, root: Option<Root>) -> Option<Value>
Like get, but takes an optional root: returns None if root is None, otherwise the result of the getter.
Sourcefn get_mut_optional(&self, root: Option<MutRoot>) -> Option<MutValue>
fn get_mut_optional(&self, root: Option<MutRoot>) -> Option<MutValue>
Like get_mut, but takes an optional root: returns None if root is None, otherwise the result of the setter.
Sourcefn get_or_else<F>(&self, root: Root, f: F) -> Valuewhere
F: FnOnce() -> Value,
fn get_or_else<F>(&self, root: Root, f: F) -> Valuewhere
F: FnOnce() -> Value,
Returns the value if the keypath succeeds, otherwise calls f and returns its result.
Sourcefn get_mut_or_else<F>(&self, root: MutRoot, f: F) -> MutValuewhere
F: FnOnce() -> MutValue,
fn get_mut_or_else<F>(&self, root: MutRoot, f: F) -> MutValuewhere
F: FnOnce() -> MutValue,
Returns the mutable value if the keypath succeeds, otherwise calls f and returns its result.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.