INNER CODE UNIT · Rust

map

fishfolk/bones · framework_crates/bones_asset/src/lib.rs:139

    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]
    pub fn and<U>(self, optb: Maybe<U>) -> Maybe<U> {
        self.option().and(optb.option()).into()
    }

    /// Returns `Unset` if the option is `Unset`, otherwise calls `predicate` with the wrapped value and returns:
    #[inline]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…