pub trait OptionUtils<T> {
// Required methods
fn or_default_with(self, fallback: T) -> T;
fn if_some<F: FnOnce(&T)>(self, f: F) -> Option<T>;
}Expand description
Extension methods for Option<T>.
Required Methods§
Sourcefn or_default_with(self, fallback: T) -> T
fn or_default_with(self, fallback: T) -> T
Returns the value inside Some, or the fallback if None.
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.