Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<T>:
    Send
    + Sync
    + 'static {
    // Required method
    fn call(
        &self,
        req: Request,
    ) -> Pin<Box<dyn Future<Output = Response> + Send + '_>>;
}

Required Methods§

Source

fn call( &self, req: Request, ) -> Pin<Box<dyn Future<Output = Response> + Send + '_>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

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

Source§

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

Source§

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