EndpointOptionExt

Trait EndpointOptionExt 

Source
pub trait EndpointOptionExt<T>: Endpoint<Output = Option<T>> + Sized {
    // Provided methods
    fn map_some<F, U>(self, f: F) -> MapSome<Self, F>
       where F: FnOnce(T) -> U + Clone + Send + Sync { ... }
    fn ok_or_else<F, U>(self, f: F) -> OkOrElse<Self, F>
       where F: FnOnce() -> U + Clone + Send + Sync { ... }
}
Expand description

A set of extension methods which is available when the output is value is an Option.

Provided Methods§

Source

fn map_some<F, U>(self, f: F) -> MapSome<Self, F>
where F: FnOnce(T) -> U + Clone + Send + Sync,

Create an endpoint which will map the value to a new type with given function.

Source

fn ok_or_else<F, U>(self, f: F) -> OkOrElse<Self, F>
where F: FnOnce() -> U + Clone + Send + Sync,

Create an endpoint which will transform the returned value into a Result.

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.

Implementors§

Source§

impl<E, T> EndpointOptionExt<T> for E
where E: Endpoint<Output = Option<T>>,