pub enum Either<A, B> {
Left(A),
Right(B),
}Available on crate feature
util only.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§
Trait Implementations§
impl<A: Copy, B: Copy> Copy for Either<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Either<A, B>
impl<A, B> RefUnwindSafe for Either<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Either<A, B>
impl<A, B> Sync for Either<A, B>
impl<A, B> Unpin for Either<A, B>
impl<A, B> UnwindSafe for Either<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<M, S, Target, Request> MakeService<Target, Request> for M
impl<M, S, Target, Request> MakeService<Target, Request> for M
Source§type Response = <S as Service<Request>>::Response
type Response = <S as Service<Request>>::Response
Available on crate feature
make only.Responses given by the service
Source§type Error = <S as Service<Request>>::Error
type Error = <S as Service<Request>>::Error
Available on crate feature
make only.Errors produced by the service
Source§type Service = S
type Service = S
Available on crate feature
make only.The
Service value created by this factorySource§type MakeError = <M as Service<Target>>::Error
type MakeError = <M as Service<Target>>::Error
Available on crate feature
make only.Errors produced while building a service.
Source§async fn make_service(
&self,
target: Target,
) -> Result<<M as MakeService<Target, Request>>::Service, <M as MakeService<Target, Request>>::MakeError>
async fn make_service( &self, target: Target, ) -> Result<<M as MakeService<Target, Request>>::Service, <M as MakeService<Target, Request>>::MakeError>
Available on crate feature
make only.Create and return a new service value asynchronously.
Source§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
Available on crate feature
make only.Source§fn as_service(&self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&self) -> AsService<'_, Self, Request>where
Self: Sized,
Available on crate feature
make only.Source§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn oneshot(
self,
req: Request,
) -> impl Future<Output = Result<Self::Response, Self::Error>>where
Self: Sized,
fn oneshot(
self,
req: Request,
) -> impl Future<Output = Result<Self::Response, Self::Error>>where
Self: Sized,
Available on crate feature
util only.Consume this
Service, calling it with the provided request once and only once.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
Available on crate feature
util only.Executes a new future after this service’s future resolves. Read more
Source§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
Available on crate feature
util only.Maps this service’s response value to a different value. Read more
Source§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
Available on crate feature
util only.Maps this service’s error value to a different value. Read more
Source§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Available on crate feature
util only.Maps this service’s result type (
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read moreSource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Available on crate feature
util only.Composes a function in front of the service. Read more
Source§fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>
fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>
Available on crate features
util and filter only.Source§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
Available on crate features
util and filter only.Composes this service with an
AsyncFilter that conditionally accepts or
rejects requests based on an [async predicate]. Read more