pub trait AsyncEndpoint<I, O>: EndpointMetadata {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        req: Request<I>,
        response_extensions: &'life1 mut Extensions
    ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncResponseBody<O>>, Error>> + Send + 'async_trait>>
       where I: 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A nonblocking HTTP endpoint.

Required Methods§

source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, req: Request<I>, response_extensions: &'life1 mut Extensions ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncResponseBody<O>>, Error>> + Send + 'async_trait>>
where I: 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handles a request to the endpoint.

If the endpoint has path parameters, callers must include a PathParams extension in the request containing the extracted parameters from the URI. The implementation is reponsible for all other request handling, including parsing query parameters, header parameters, and the request body.

The response_extensions will be added to the extensions of the response produced by the endpoint, even if an error is returned.

Implementations on Foreign Types§

source§

impl<T, I, O> AsyncEndpoint<I, O> for Box<T>
where T: ?Sized + AsyncEndpoint<I, O>,

source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, req: Request<I>, response_extensions: &'life1 mut Extensions ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncResponseBody<O>>, Error>> + Send + 'async_trait>>
where I: 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§