pub trait EndpointResultExt<A, B>: Endpoint<Output = Result<A, B>> + Sized {
// Provided methods
fn as_ok<T>(self) -> Self
where Self::Output: IsResult<Ok = T> { ... }
fn as_err<E>(self) -> Self
where Self::Output: IsResult<Err = E> { ... }
fn map_ok<F, U>(self, f: F) -> MapOk<Self, F>
where F: FnOnce(A) -> U + Clone + Send + Sync { ... }
fn map_err<F, U>(self, f: F) -> MapErr<Self, F>
where F: FnOnce(B) -> U + Clone + Send + Sync { ... }
fn err_into<U>(self) -> ErrInto<Self, U>
where B: Into<U> { ... }
fn and_then<F, U>(self, f: F) -> AndThen<Self, F>
where F: FnOnce(A) -> Result<U, B> + Clone + Send + Sync { ... }
fn or_else<F, U>(self, f: F) -> OrElse<Self, F>
where F: FnOnce(B) -> Result<A, U> + Clone + Send + Sync { ... }
fn unwrap_ok(self) -> UnwrapOk<Self>
where B: Into<Error> { ... }
}Expand description
A set of extension methods which is available when the output value is a Result.
Provided Methods§
Sourcefn as_ok<T>(self) -> Self
fn as_ok<T>(self) -> Self
Annotate that the successful type of associated type Output is equal to T.
Sourcefn as_err<E>(self) -> Self
fn as_err<E>(self) -> Self
Annotate that the error type of associated type Output is equal to E.
Sourcefn map_ok<F, U>(self, f: F) -> MapOk<Self, F>
fn map_ok<F, U>(self, f: F) -> MapOk<Self, F>
Create an endpoint which will map the successful value to a new type with given function.
Sourcefn map_err<F, U>(self, f: F) -> MapErr<Self, F>
fn map_err<F, U>(self, f: F) -> MapErr<Self, F>
Create an endpoint which will map the error value to a new type with given function.
Sourcefn err_into<U>(self) -> ErrInto<Self, U>where
B: Into<U>,
fn err_into<U>(self) -> ErrInto<Self, U>where
B: Into<U>,
Create an endpoint which will convert the error value to a new type.
Sourcefn and_then<F, U>(self, f: F) -> AndThen<Self, F>
fn and_then<F, U>(self, f: F) -> AndThen<Self, F>
Create an endpoint which will map the successful value to a Result with given function.
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.