among

Trait AmongErrorExt

source
pub trait AmongErrorExt<T, L, M, R> {
    // Required methods
    fn map_err_left<F, N>(self, l: F) -> Result<T, Among<N, M, R>>
       where F: FnOnce(L) -> N;
    fn map_err_middle<F, N>(self, m: F) -> Result<T, Among<L, N, R>>
       where F: FnOnce(M) -> N;
    fn map_err_right<F, N>(self, r: F) -> Result<T, Among<L, M, N>>
       where F: FnOnce(R) -> N;
}
Expand description

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

Required Methods§

source

fn map_err_left<F, N>(self, l: F) -> Result<T, Among<N, M, R>>
where F: FnOnce(L) -> N,

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

source

fn map_err_middle<F, N>(self, m: F) -> Result<T, Among<L, N, R>>
where F: FnOnce(M) -> N,

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

source

fn map_err_right<F, N>(self, r: F) -> Result<T, Among<L, M, N>>
where F: FnOnce(R) -> N,

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, L, M, R> AmongErrorExt<T, L, M, R> for Result<T, Among<L, M, R>>

source§

fn map_err_left<F, N>(self, f: F) -> Result<T, Among<N, M, R>>
where F: FnOnce(L) -> N,

source§

fn map_err_middle<F, N>(self, f: F) -> Result<T, Among<L, N, R>>
where F: FnOnce(M) -> N,

source§

fn map_err_right<F, N>(self, f: F) -> Result<T, Among<L, M, N>>
where F: FnOnce(R) -> N,

Implementors§