pub enum OptionService<A, B> {
Some(A),
None(B),
}Available on crate feature
util only.Expand description
The Service produced by OptionLayer.
Its error type is BoxError, erasing any difference between the layered
and unlayered branches’ error types.
Variants§
Some(A)
The inner layer was present; the layered service.
None(B)
The inner layer was absent; the unmodified service.
Trait Implementations§
Source§impl<A: Clone, B: Clone> Clone for OptionService<A, B>
impl<A: Clone, B: Clone> Clone for OptionService<A, B>
Source§fn clone(&self) -> OptionService<A, B>
fn clone(&self) -> OptionService<A, B>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<A: Copy, B: Copy> Copy for OptionService<A, B>
Source§impl<A, B, Request> Service<Request> for OptionService<A, B>
impl<A, B, Request> Service<Request> for OptionService<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for OptionService<A, B>
impl<A, B> RefUnwindSafe for OptionService<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for OptionService<A, B>
impl<A, B> Sync for OptionService<A, B>
impl<A, B> Unpin for OptionService<A, B>
impl<A, B> UnsafeUnpin for OptionService<A, B>where
A: UnsafeUnpin,
B: UnsafeUnpin,
impl<A, B> UnwindSafe for OptionService<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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§type Future = <M as Service<Target>>::Future
type Future = <M as Service<Target>>::Future
Available on crate feature
make only.The future of the
Service instance.Source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
Available on crate feature
make only.Returns
Poll::Ready when the factory is able to create more services. Read moreSource§fn make_service(
&mut self,
target: Target,
) -> <M as MakeService<Target, Request>>::Future
fn make_service( &mut self, target: Target, ) -> <M as MakeService<Target, Request>>::Future
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(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&mut 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 ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
Available on crate feature
util only.Yields a mutable reference to the service when it is ready to accept a request.
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
Available on crate feature
util only.Yields the service when it is ready to accept a request.
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
Available on crate feature
util only.Consume this
Service, calling it with the provided request once it is ready.Source§fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
S: Stream<Item = Request>,
fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
S: Stream<Item = Request>,
Available on crate feature
util only.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. This does
not alter the behaviour of the
poll_ready method. Read moreSource§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. This does not
alter the behaviour of the
poll_ready method. Read moreSource§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. This does not
alter the behaviour of the
poll_ready method. Read moreSource§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
filter and util 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
filter and util only.Composes this service with an
AsyncFilter that conditionally accepts or
rejects requests based on an [async predicate]. Read moreSource§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Available on crate feature
util only.Composes an asynchronous function after this service. Read more
Source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
Available on crate feature
util only.Composes a function that transforms futures produced by the service. Read more
Source§fn buffered(self, bound: usize) -> Buffer<Request, Self::Future>
fn buffered(self, bound: usize) -> Buffer<Request, Self::Future>
Available on crate features
buffer and util only.Returns a buffered version of this service. Read more
Source§fn retry<P>(self, policy: P) -> Retry<P, Self>where
Self: Sized,
fn retry<P>(self, policy: P) -> Retry<P, Self>where
Self: Sized,
Available on crate features
retry and util only.Returns a retry version of this service. Read more