Trait freya::prelude::WritableOptionExt
pub trait WritableOptionExt<T>: Writable<Target = Option<T>>where
T: 'static,{
// Provided methods
fn get_or_insert(&mut self, default: T) -> Self::Mut<T> { ... }
fn get_or_insert_with(
&mut self,
default: impl FnOnce() -> T
) -> Self::Mut<T> { ... }
fn as_mut(&mut self) -> Option<Self::Mut<T>> { ... }
}
Expand description
An extension trait for Writable<Option
Provided Methods§
fn get_or_insert(&mut self, default: T) -> Self::Mut<T>
fn get_or_insert(&mut self, default: T) -> Self::Mut<T>
Gets the value out of the Option, or inserts the given value if the Option is empty.
fn get_or_insert_with(&mut self, default: impl FnOnce() -> T) -> Self::Mut<T>
fn get_or_insert_with(&mut self, default: impl FnOnce() -> T) -> Self::Mut<T>
Gets the value out of the Option, or inserts the value returned by the given function if the Option is empty.
Object Safety§
This trait is not object safe.