EndpointExt

Trait EndpointExt 

Source
pub trait EndpointExt: Endpoint + Sized {
    // Provided methods
    fn as_t<T>(self) -> Self
       where Self: Endpoint<Output = T> { ... }
    fn and<E>(self, e: E) -> And<Self, E::Endpoint>
       where E: IntoEndpoint,
             Self::Output: Send,
             E::Output: Send { ... }
    fn left<E>(self, e: E) -> Left<Self, E::Endpoint>
       where E: IntoEndpoint { ... }
    fn right<E>(self, e: E) -> Right<Self, E::Endpoint>
       where E: IntoEndpoint { ... }
    fn or<E>(self, e: E) -> Or<Self, E::Endpoint>
       where E: IntoEndpoint<Output = Self::Output> { ... }
    fn lift(self) -> Lift<Self> { ... }
    fn map<F, U>(self, f: F) -> Map<Self, F>
       where F: FnOnce(Self::Output) -> U + Clone + Send + Sync { ... }
    fn inspect<F>(self, f: F) -> Inspect<Self, F>
       where F: FnOnce(&Self::Output) + Clone + Send + Sync { ... }
    fn map_async<F, T>(self, f: F) -> MapAsync<Self, F>
       where F: FnOnce(Self::Output) -> T + Clone + Send + Sync,
             T: IntoTask,
             T::Task: Send { ... }
}
Expand description

A set of extension methods used for composing complicate endpoints.

Provided Methods§

Source

fn as_t<T>(self) -> Self
where Self: Endpoint<Output = T>,

Annotate that the associated type Output is equal to T.

Source

fn and<E>(self, e: E) -> And<Self, E::Endpoint>
where E: IntoEndpoint, Self::Output: Send, E::Output: Send,

Create an endpoint which evaluates self and e and returns a pair of their tasks.

The returned future from this endpoint contains both futures from self and e and resolved as a pair of values returned from theirs.

Source

fn left<E>(self, e: E) -> Left<Self, E::Endpoint>
where E: IntoEndpoint,

Create an endpoint which evaluates self and e and returns the task of self if matched.

Source

fn right<E>(self, e: E) -> Right<Self, E::Endpoint>
where E: IntoEndpoint,

Create an endpoint which evaluates self and e and returns the task of e if matched.

Source

fn or<E>(self, e: E) -> Or<Self, E::Endpoint>
where E: IntoEndpoint<Output = Self::Output>,

Create an endpoint which evaluates self and e sequentially.

The returned future from this endpoint contains the one returned from either self or e matched “better” to the input.

Source

fn lift(self) -> Lift<Self>

Create an endpoint which returns None if the inner endpoint skips the request.

Source

fn map<F, U>(self, f: F) -> Map<Self, F>
where F: FnOnce(Self::Output) -> U + Clone + Send + Sync,

Create an endpoint which maps the returned value to a different type.

Source

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where F: FnOnce(&Self::Output) + Clone + Send + Sync,

Create an endpoint which do something with the output value from self.

Source

fn map_async<F, T>(self, f: F) -> MapAsync<Self, F>
where F: FnOnce(Self::Output) -> T + Clone + Send + Sync, T: IntoTask, T::Task: Send,

Create an endpoint which continue an asynchronous computation from the value returned from self.

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§