Skip to main content

Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn call(&self, request: Request) -> BoxFuture<Response>;
}
Expand description

Anything that can answer a request.

Implemented for every async fn(Request) -> impl IntoResponse, so an application never names this trait: it just writes a function.

Required Methods§

Source

fn call(&self, request: Request) -> BoxFuture<Response>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Handler for Files

Source§

impl Handler for Fixed

Source§

impl<F, Fut, R> Handler for F
where F: Fn(Request) -> Fut + Send + Sync + 'static, Fut: Future<Output = R> + Send + 'static, R: IntoResponse + 'static,