Skip to main content

Handler

Trait Handler 

Source
pub trait Handler: Sync {
    type Error: Error + Send + Sync + 'static;
    type Body<B: ReadableBody>: ReadableBody;

    // Required method
    fn call<B: ReadableBody, I: InterimHandler>(
        &self,
        request: Request<B>,
        interim: &mut InterimResponses<I>,
        cancellation: &Cancellation,
    ) -> impl Future<Output = Result<Response<Self::Body<B>>, Self::Error>> + Send;
}
Expand description

Generic bodies and hooks keep handlers independent of the HTTP wire version and scheduler. A returned body may retain the request body, including borrows.

Required Associated Types§

Required Methods§

Source

fn call<B: ReadableBody, I: InterimHandler>( &self, request: Request<B>, interim: &mut InterimResponses<I>, cancellation: &Cancellation, ) -> impl Future<Output = Result<Response<Self::Body<B>>, Self::Error>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§