pub trait OptionExt<T> {
// Required methods
fn unwrap_or_auto<T2>(self, default: T2) -> T2
where T2: From<T>;
fn map_auto<T2>(self) -> Option<T2>
where T2: From<T>;
fn ok_or_auto<O, E>(self, err: E) -> Result<O, E>
where O: From<T>;
}
Expand description
An extension trait for Option
s.
Required Methods§
fn unwrap_or_auto<T2>(self, default: T2) -> T2where
T2: From<T>,
fn unwrap_or_auto<T2>(self, default: T2) -> T2where
T2: From<T>,
Unwraps the option, or returns a default value (converted to the option’s type).
fn ok_or_auto<O, E>(self, err: E) -> Result<O, E>where
O: From<T>,
fn ok_or_auto<O, E>(self, err: E) -> Result<O, E>where
O: From<T>,
Unwraps the option, or returns an error.
Object Safety§
This trait is not object safe.