Handler

Trait Handler 

Source
pub trait Handler<T>:
    Clone
    + Send
    + Sync
    + Sized
    + 'static {
    type Future: Future<Output = Response> + Send + 'static;

    // Required methods
    fn call(self, req: Request) -> Self::Future;
    fn update_operation(op: &mut Operation);
}
Expand description

Trait representing an async handler function

Required Associated Types§

Source

type Future: Future<Output = Response> + Send + 'static

The response type

Required Methods§

Source

fn call(self, req: Request) -> Self::Future

Call the handler with the request

Source

fn update_operation(op: &mut Operation)

Update the OpenAPI operation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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

Source§

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

Source§

impl<F, Fut, Res, T1> Handler<(T1,)> for F
where F: FnOnce(T1) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoResponse + ResponseModifier, T1: FromRequest + OperationModifier + Send + 'static,

Source§

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

Source§

impl<F, Fut, Res, T1, T2> Handler<(T1, T2)> for F
where F: FnOnce(T1, T2) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoResponse + ResponseModifier, T1: FromRequest + OperationModifier + Send + 'static, T2: FromRequest + OperationModifier + Send + 'static,

Source§

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

Source§

impl<F, Fut, Res, T1, T2, T3> Handler<(T1, T2, T3)> for F
where F: FnOnce(T1, T2, T3) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoResponse + ResponseModifier, T1: FromRequest + OperationModifier + Send + 'static, T2: FromRequest + OperationModifier + Send + 'static, T3: FromRequest + OperationModifier + Send + 'static,

Source§

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

Source§

impl<F, Fut, Res, T1, T2, T3, T4> Handler<(T1, T2, T3, T4)> for F
where F: FnOnce(T1, T2, T3, T4) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoResponse + ResponseModifier, T1: FromRequest + OperationModifier + Send + 'static, T2: FromRequest + OperationModifier + Send + 'static, T3: FromRequest + OperationModifier + Send + 'static, T4: FromRequest + OperationModifier + Send + 'static,

Source§

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

Source§

impl<F, Fut, Res, T1, T2, T3, T4, T5> Handler<(T1, T2, T3, T4, T5)> for F
where F: FnOnce(T1, T2, T3, T4, T5) -> Fut + Clone + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoResponse + ResponseModifier, T1: FromRequest + OperationModifier + Send + 'static, T2: FromRequest + OperationModifier + Send + 'static, T3: FromRequest + OperationModifier + Send + 'static, T4: FromRequest + OperationModifier + Send + 'static, T5: FromRequest + OperationModifier + Send + 'static,

Source§

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