pub struct CodecHandlerFn<H, I, D> { /* private fields */ }
Expand description
Transforms a function (that returns IntoCodecResponse
) into a regular
handler.
Trait Implementations§
Source§impl<H, I, D> Clone for CodecHandlerFn<H, I, D>where
H: Clone,
impl<H, I, D> Clone for CodecHandlerFn<H, I, D>where
H: Clone,
Source§impl<T, H, I, D, S> Handler<T, S> for CodecHandlerFn<H, I, D>where
H: CodecHandler<T, I, D, S> + Sync,
S: Send + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
impl<T, H, I, D, S> Handler<T, S> for CodecHandlerFn<H, I, D>where
H: CodecHandler<T, I, D, S> + Sync,
S: Send + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
Source§type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
The type of future calling this handler returns.
Source§fn call(self, req: Request, state: S) -> Self::Future
fn call(self, req: Request, state: S) -> Self::Future
Call the handler with the given request.
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer
to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service
by providing the stateSource§impl<H, I, D> OperationInput for CodecHandlerFn<H, I, D>where
I: OperationInput,
impl<H, I, D> OperationInput for CodecHandlerFn<H, I, D>where
I: OperationInput,
Source§fn operation_input(ctx: &mut GenContext, operation: &mut Operation)
fn operation_input(ctx: &mut GenContext, operation: &mut Operation)
Modify the operation. Read more
Source§fn inferred_early_responses(
ctx: &mut GenContext,
operation: &mut Operation,
) -> Vec<(Option<u16>, Response)>
fn inferred_early_responses( ctx: &mut GenContext, operation: &mut Operation, ) -> Vec<(Option<u16>, Response)>
Inferred early responses are used to document early returns for
extractors, guards inside handlers. For example these could represent
JSON parsing errors, authentication failures. Read more
Source§impl<H, I, D> OperationOutput for CodecHandlerFn<H, I, D>where
D: OperationOutput,
impl<H, I, D> OperationOutput for CodecHandlerFn<H, I, D>where
D: OperationOutput,
Source§fn operation_response(
ctx: &mut GenContext,
operation: &mut Operation,
) -> Option<Response>
fn operation_response( ctx: &mut GenContext, operation: &mut Operation, ) -> Option<Response>
Return a response documentation for this type,
alternatively modify the operation if required. Read more
Source§fn inferred_responses(
ctx: &mut GenContext,
operation: &mut Operation,
) -> Vec<(Option<u16>, Response)>
fn inferred_responses( ctx: &mut GenContext, operation: &mut Operation, ) -> Vec<(Option<u16>, Response)>
Inferred responses are used when the type is
used as a request handler return type. Read more
Auto Trait Implementations§
impl<H, I, D> Freeze for CodecHandlerFn<H, I, D>where
H: Freeze,
impl<H, I, D> RefUnwindSafe for CodecHandlerFn<H, I, D>where
H: RefUnwindSafe,
I: RefUnwindSafe,
impl<H, I, D> Send for CodecHandlerFn<H, I, D>
impl<H, I, D> Sync for CodecHandlerFn<H, I, D>
impl<H, I, D> Unpin for CodecHandlerFn<H, I, D>
impl<H, I, D> UnwindSafe for CodecHandlerFn<H, I, D>where
H: UnwindSafe,
I: 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<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service
and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService
which stores information
about the incoming connection and has no state. Read more