among

Trait EitherOkExt

source
pub trait EitherOkExt<E, A, B> {
    // Required methods
    fn map_left<F, U>(self, f: F) -> Result<Either<U, B>, E>
       where F: FnOnce(A) -> U;
    fn map_right<F, U>(self, f: F) -> Result<Either<A, U>, E>
       where F: FnOnce(B) -> U;
}
Available on crate feature either only.
Expand description

An extension trait for Result<Either<A, B>, _> that provides additional methods.

Required Methods§

source

fn map_left<F, U>(self, f: F) -> Result<Either<U, B>, E>
where F: FnOnce(A) -> U,

Apply the function f on the value in the Left variant if it is present rewrapping the result in Left.

source

fn map_right<F, U>(self, f: F) -> Result<Either<A, U>, E>
where F: FnOnce(B) -> U,

Apply the function f on the value in the Right variant if it is present rewrapping the result in Right.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<E, A, B> EitherOkExt<E, A, B> for Result<Either<A, B>, E>

source§

fn map_left<F, U>(self, f: F) -> Result<Either<U, B>, E>
where F: FnOnce(A) -> U,

source§

fn map_right<F, U>(self, f: F) -> Result<Either<A, U>, E>
where F: FnOnce(B) -> U,

Implementors§