INNER CODE UNIT · Rust
unwrap_or_else
fishfolk/bones · framework_crates/bones_asset/src/lib.rs:133
pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
self.option().unwrap_or_else(f)
}
/// Maps a `Maybe<T>` to `Maybe<U>` by applying a function to a contained value.
#[inline]
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Maybe<U> {
self.option().map(f).into()
}
/// Returns `Unset` if the option is `Unset`, otherwise calls `f` with the wrapped value and returns the result.
#[inline]
pub fn and_then<U, F: FnOnce(T) -> Maybe<U>>(self, f: F) -> Maybe<U> {
self.option().and_then(|x| f(x).option()).into()
}
/// Returns `Unset` if the option is `Unset`, otherwise returns `optb`.
#[inline]