pub struct Callback<S, M> { /* private fields */ }
Expand description
Middleware that adds callbacks to a Service
.
See the module docs for an example.
Implementations§
Source§impl<S, M> Callback<S, M>
impl<S, M> Callback<S, M>
Sourcepub fn layer(make_handler: M) -> CallbackLayer<M>where
M: MakeCallbackHandler,
pub fn layer(make_handler: M) -> CallbackLayer<M>where
M: MakeCallbackHandler,
Returns a new Layer
that wraps services with a CallbackLayer
middleware.
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
Trait Implementations§
Source§impl<S, M, RequestBody, ResponseBodyT> Service<Request<RequestBody>> for Callback<S, M>where
S: Service<Request<RequestBody>, Response = Response<ResponseBodyT>, Error: Display + 'static>,
M: MakeCallbackHandler,
RequestBody: Body<Error: Display + 'static>,
ResponseBodyT: Body<Error: Display + 'static>,
impl<S, M, RequestBody, ResponseBodyT> Service<Request<RequestBody>> for Callback<S, M>where
S: Service<Request<RequestBody>, Response = Response<ResponseBodyT>, Error: Display + 'static>,
M: MakeCallbackHandler,
RequestBody: Body<Error: Display + 'static>,
ResponseBodyT: Body<Error: Display + 'static>,
Source§type Response = Response<ResponseBody<ResponseBodyT, <M as MakeCallbackHandler>::Handler>>
type Response = Response<ResponseBody<ResponseBodyT, <M as MakeCallbackHandler>::Handler>>
Responses given by the service.
Source§type Future = ResponseFuture<<S as Service<Request<RequestBody>>>::Future, <M as MakeCallbackHandler>::Handler>
type Future = ResponseFuture<<S as Service<Request<RequestBody>>>::Future, <M as MakeCallbackHandler>::Handler>
The future response value.
impl<S: Copy, M: Copy> Copy for Callback<S, M>
Auto Trait Implementations§
impl<S, M> Freeze for Callback<S, M>
impl<S, M> RefUnwindSafe for Callback<S, M>where
S: RefUnwindSafe,
M: RefUnwindSafe,
impl<S, M> Send for Callback<S, M>
impl<S, M> Sync for Callback<S, M>
impl<S, M> Unpin for Callback<S, M>
impl<S, M> UnwindSafe for Callback<S, M>where
S: UnwindSafe,
M: 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>
§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Yields a mutable reference to the service when it is ready to accept a request.
§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Yields the service when it is ready to accept a request.
§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Consume this
Service
, calling it with the provided request once it is ready.§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
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>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read more§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready
method. Read more§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
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>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
Composes a function in front of the service. Read more
§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
Composes an asynchronous function after this service. Read more
§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>
Composes a function that transforms futures produced by the service. Read more