Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<St, T>: 'static
where St: State,
{ type Output: Responder<St>; // Required method async fn call(&self, param: T) -> Self::Output; }
Expand description

Async fn handler.

Implemented for async functions and closures that take up to 16 extractors. T is the tuple of extractor types. Register such handlers with Route::to(). Use HandlerSt when the handler needs the application or request state.

Required Associated Types§

Source

type Output: Responder<St>

Handler result, converted into a response.

Required Methods§

Source

async fn call(&self, param: T) -> Self::Output

Call the handler with the extracted values.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<St, F, R> Handler<St, ()> for F
where F: AsyncFn() -> R + 'static, R: Responder<St>, St: State,

Source§

impl<St, Func, T0, Res> Handler<St, (T0,)> for Func
where St: State, Func: 'static + AsyncFn(T0) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, Res> Handler<St, (T0, T1)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, Res> Handler<St, (T0, T1, T2)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, Res> Handler<St, (T0, T1, T2, T3)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, Res> Handler<St, (T0, T1, T2, T3, T4)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, Res> Handler<St, (T0, T1, T2, T3, T4, T5)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) -> Res, Res: Responder<St>,

Source§

type Output = Res

Source§

impl<St, Func, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, Res> Handler<St, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> for Func
where St: State, Func: 'static + AsyncFn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) -> Res, Res: Responder<St>,

Source§

type Output = Res