Trait freya::prelude::WritableOptionExt
pub trait WritableOptionExt<T>: Writable<Option<T>>where
T: 'static,{
// Provided methods
fn get_or_insert(&self, default: T) -> Self::Mut<T> { ... }
fn get_or_insert_with(&self, default: impl FnOnce() -> T) -> Self::Mut<T> { ... }
fn as_mut(&self) -> Option<Self::Mut<T>> { ... }
}
Expand description
An extension trait for Writable<Option
Provided Methods§
fn get_or_insert(&self, default: T) -> Self::Mut<T>
fn get_or_insert(&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(&self, default: impl FnOnce() -> T) -> Self::Mut<T>
fn get_or_insert_with(&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.