Enum actix_net::either::EitherService
source · pub enum EitherService<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.
EitherService
is useful for handling conditional branching in service
middleware to different inner service types.
Variants§
Trait Implementations§
source§impl<A, B> Service for EitherService<A, B>where
A: Service,
B: Service<Request = A::Request, Response = A::Response, Error = A::Error>,
impl<A, B> Service for EitherService<A, B>where
A: Service,
B: Service<Request = A::Request, Response = A::Response, Error = A::Error>,
Auto Trait Implementations§
impl<A, B> RefUnwindSafe for EitherService<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for EitherService<A, B>where
A: Send,
B: Send,
impl<A, B> Sync for EitherService<A, B>where
A: Sync,
B: Sync,
impl<A, B> Unpin for EitherService<A, B>where
A: Unpin,
B: Unpin,
impl<A, B> UnwindSafe for EitherService<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
source§impl<T> IntoService<T> for Twhere
T: Service,
impl<T> IntoService<T> for Twhere
T: Service,
source§fn into_service(self) -> T
fn into_service(self) -> T
Convert to a
Service
source§impl<T> ServiceExt for Twhere
T: Service + ?Sized,
impl<T> ServiceExt for Twhere
T: Service + ?Sized,
source§fn apply<S, I, F, R>(
self,
service: I,
f: F
) -> AndThen<Self, Apply<S, F, R, Self::Response>>where
Self: Sized,
S: Service,
S::Error: Into<<R::Future as Future>::Error>,
I: IntoService<S>,
F: Fn(Self::Response, &mut S) -> R,
R: IntoFuture<Error = Self::Error>,
fn apply<S, I, F, R>(
self,
service: I,
f: F
) -> AndThen<Self, Apply<S, F, R, Self::Response>>where
Self: Sized,
S: Service,
S::Error: Into<<R::Future as Future>::Error>,
I: IntoService<S>,
F: Fn(Self::Response, &mut S) -> R,
R: IntoFuture<Error = Self::Error>,
Apply function to specified service and use it as a next service in
chain. Read more
source§fn and_then<F, B>(self, service: F) -> AndThen<Self, B>where
Self: Sized,
F: IntoService<B>,
B: Service<Request = Self::Response, Error = Self::Error>,
fn and_then<F, B>(self, service: F) -> AndThen<Self, B>where
Self: Sized,
F: IntoService<B>,
B: Service<Request = Self::Response, Error = Self::Error>,
Call another service after call to this one has resolved successfully. Read more
source§fn then<B>(self, service: B) -> Then<Self, B>where
Self: Sized,
B: Service<Request = Result<Self::Response, Self::Error>, Error = Self::Error>,
fn then<B>(self, service: B) -> Then<Self, B>where
Self: Sized,
B: Service<Request = Result<Self::Response, Self::Error>, Error = Self::Error>,
Chain on a computation for when a call to the service finished,
passing the result of the call to the next service
B
. Read more