Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<Args> {
    type Future: Future<Output = Response<Body>> + Send;

    // Required method
    fn call(&self, args: Args) -> Self::Future;
}
Expand description

Handler trait - 用于处理 HTTP 请求

Required Associated Types§

Source

type Future: Future<Output = Response<Body>> + Send

Required Methods§

Source

fn call(&self, args: Args) -> Self::Future

Implementors§

Source§

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

Source§

type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>

Source§

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

Source§

type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>