pub trait EndpointExt: IsEndpoint + Sized {
fn and<E>(self, other: E) -> And<Self, E> { ... }
fn or<E>(self, other: E) -> Or<Self, E> { ... }
fn or_strict<E>(self, other: E) -> OrStrict<Self, E> { ... }
fn map<F>(self, f: F) -> Map<Self, F> { ... }
fn and_then<F>(self, f: F) -> AndThen<Self, F> { ... }
fn map_err<F>(self, f: F) -> MapErr<Self, F> { ... }
fn recover<F>(self, f: F) -> Recover<Self, F> { ... }
}
A set of extension methods for combining the multiple endpoints.
fn and<E>(self, other: E) -> And<Self, E>
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.
fn or<E>(self, other: E) -> Or<Self, E>
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.
fn or_strict<E>(self, other: E) -> OrStrict<Self, E>
Create an endpoint which evaluates self
and e
sequentially.
The differences of behaviour to Or
are as follows:
- The associated type
E::Output
must be equal to Self::Output
.
It means that the generated endpoint has the same output type
as the original endpoints and the return value will be used later.
- If
self
is matched to the request, other.apply(cx)
is not called and the future returned from self.apply(cx)
is
immediately returned.
fn map<F>(self, f: F) -> Map<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn map_err<F>(self, f: F) -> MapErr<Self, F>
fn recover<F>(self, f: F) -> Recover<Self, F>