Map

Trait Map 

Source
pub trait Map: Sized {
    // Required methods
    fn ok(self) -> Result<Self, Self>;
    fn ok_or<E>(self, err: E) -> Result<Self, E>;
    fn map<T>(self, f: impl FnOnce() -> T) -> Option<T>;
    fn and_then<T>(self, f: impl FnOnce() -> Option<T>) -> Option<T>;
    fn unwrap(self) -> Self;
    fn expect(self, message: impl Display) -> Self;
}

Required Methods§

Source

fn ok(self) -> Result<Self, Self>

Source

fn ok_or<E>(self, err: E) -> Result<Self, E>

Source

fn map<T>(self, f: impl FnOnce() -> T) -> Option<T>

Source

fn and_then<T>(self, f: impl FnOnce() -> Option<T>) -> Option<T>

Source

fn unwrap(self) -> Self

Source

fn expect(self, message: impl Display) -> Self

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.

Implementations on Foreign Types§

Source§

impl Map for bool

Source§

fn ok(self) -> Result<Self, Self>

Source§

fn ok_or<E>(self, err: E) -> Result<Self, E>

Source§

fn map<T>(self, f: impl FnOnce() -> T) -> Option<T>

Source§

fn and_then<T>(self, f: impl FnOnce() -> Option<T>) -> Option<T>

Source§

fn unwrap(self) -> Self

Source§

fn expect(self, message: impl Display) -> Self

Implementors§