pub trait OptionExt<T> {
// Required method
fn map_or_default<U: Default, F>(self, f: F) -> U
where F: FnOnce(T) -> U;
}Expand description
Extra methods for Option.
Required Methods§
Sourcefn map_or_default<U: Default, F>(self, f: F) -> Uwhere
F: FnOnce(T) -> U,
fn map_or_default<U: Default, F>(self, f: F) -> Uwhere
F: FnOnce(T) -> U,
Maps an Option<T> to U by applying a function to a contained value
(if Some) or returns a default (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.