Trait under::Endpoint

source ·
pub trait Endpoint: Send + Sync + 'static {
    fn apply<'life0, 'async_trait>(
        self: Pin<&'life0 Self>,
        request: Request
    ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; }
Expand description

An HTTP request handler.

This is automatically implemented for Fn(Request) -> impl Future<Output = impl IntoResponse> types, but it may be useful to implement this yourself. All this is meant to do is be a fallible function from a Request into a Response.

Required Methods§

Transforms the request into the response. However, a request may fail, and such a failure can be handled by down the stack.

Trait Implementations§

Formats the value using the given formatter. Read more

Implementors§