among

Trait EitherErrExt

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

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

Required Methods§

source

fn map_err_left<F, U>(self, f: F) -> Result<T, Either<U, B>>
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_err_right<F, U>(self, f: F) -> Result<T, Either<A, U>>
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<T, A, B> EitherErrExt<T, A, B> for Result<T, Either<A, B>>

source§

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

source§

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

Implementors§