Enum tower::util::Either [−][src]
pub enum Either<A, B> {
A(A),
B(B),
}
Expand description
Combine two different service types into a single type.
Both services must be of the same request, response, and error types.
Either
is useful for handling conditional branching in service middleware
to different inner service types.
Variants
One type of backing Service
.
The other type of backing Service
.
Trait Implementations
Returns Poll::Ready(Ok(()))
when the service is able to process requests. Read more
Auto Trait Implementations
impl<A, B> RefUnwindSafe for Either<A, B> where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> UnwindSafe for Either<A, B> where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Map this future’s output to a different type, returning a new future of the resulting type. Read more
Map this future’s output to a different type, returning a new future of the resulting type. Read more
Chain on a computation for when a future finished, passing the result of
the future to the provided closure f
. Read more
Wrap this future in an Either
future, making it the left-hand variant
of that Either
. Read more
Wrap this future in an Either
future, making it the right-hand variant
of that Either
. Read more
Convert this future into a single element stream. Read more
Flatten the execution of this future when the output of this future is itself another future. Read more
Flatten the execution of this future when the successful result of this future is a stream. Read more
Fuse a future such that poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read more
Do something with the output of a future before passing it on. Read more
Catches unwinding panics while polling the future. Read more
Create a cloneable handle to this future where all handles will resolve to the same result. Read more
Wrap the future in a Box, pinning it. Read more
Wrap the future in a Box, pinning it. Read more
Turns a Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>. Read more
Turns a Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>. Read more
A convenience for calling Future::poll
on Unpin
future types.
Evaluates and consumes the future, returning the resulting output if
the future is ready after the first call to Future::poll
. Read more
into_future
)The output that the future will produce on completion.
type Future = F
type Future = F
into_future
)Which kind of future are we turning this into?
into_future
)Creates a future from a value.
Yields a mutable reference to the service when it is ready to accept a request.
please use the ServiceExt::ready
method instead
Yields a mutable reference to the service when it is ready to accept a request.
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>ⓘNotable traits for ReadyOneshot<T, Request>impl<T, Request> Future for ReadyOneshot<T, Request> where
T: Service<Request>, type Output = Result<T, T::Error>;
where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>ⓘNotable traits for ReadyOneshot<T, Request>impl<T, Request> Future for ReadyOneshot<T, Request> where
T: Service<Request>, type Output = Result<T, T::Error>;
where
Self: Sized,
impl<T, Request> Future for ReadyOneshot<T, Request> where
T: Service<Request>, type Output = Result<T, T::Error>;
Yields the service when it is ready to accept a request.
Consume this Service
, calling with the providing request once it is ready.
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the poll_ready
method. Read more
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F> where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F> where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
Maps this service’s response value to a different value. This does not
alter the behaviour of the poll_ready
method. Read more
Maps this service’s error value to a different value. This does not
alter the behaviour of the poll_ready
method. Read more
Maps this service’s result type (Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read more
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F> where
Self: Sized,
F: FnMut(NewRequest) -> Request + Clone,
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F> where
Self: Sized,
F: FnMut(NewRequest) -> Request + Clone,
Composes a function in front of the service. Read more
Composes an asynchronous function after this service. Read more
Maps this future’s success value to a different value. Read more
Maps this future’s success value to a different value, and permits for error handling resulting in the same type. Read more
Maps this future’s error value to a different value. Read more
Executes another future after this one resolves successfully. The success value is passed to a closure to create this subsequent future. Read more
Executes another future if this one resolves to an error. The error value is passed to a closure to create this subsequent future. Read more
Do something with the success value of a future before passing it on. Read more
Do something with the error value of a future before passing it on. Read more
Flatten the execution of this future when the successful result of this future is another future. Read more
Flatten the execution of this future when the successful result of this future is a stream. Read more
fn unwrap_or_else<F>(self, f: F) -> UnwrapOrElse<Self, F> where
F: FnOnce(Self::Error) -> Self::Ok,
fn unwrap_or_else<F>(self, f: F) -> UnwrapOrElse<Self, F> where
F: FnOnce(Self::Error) -> Self::Ok,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more