pub trait Handler<T>:
Clone
+ Send
+ Sync
+ 'static {
type Future: Future<Output = Response> + Send + 'static;
// Required method
fn call(&self, req: Request) -> Self::Future;
}
Expand description
A trait for handling HTTP requests
Required Associated Types§
Required Methods§
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> Handler<()> for F
Implement Handler for async functions that take Request and return Response
impl<F, Fut> Handler<()> for F
Implement Handler for async functions that take Request and return Response
Source§impl<F, Fut, Res> Handler<((),)> for F
Handler for async functions with no extractors (just returns a response)
impl<F, Fut, Res> Handler<((),)> for F
Handler for async functions with no extractors (just returns a response)
Source§impl<F, Fut, Res> Handler<(Request,)> for F
Handler for async functions that take Request directly
impl<F, Fut, Res> Handler<(Request,)> for F
Handler for async functions that take Request directly
Source§impl<F, Fut, Res, E1> Handler<(E1,)> for Fwhere
F: Fn(E1) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
Handler for functions with one extractor
impl<F, Fut, Res, E1> Handler<(E1,)> for Fwhere
F: Fn(E1) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
Handler for functions with one extractor
Source§impl<F, Fut, Res, E1, E2> Handler<(E1, E2)> for Fwhere
F: Fn(E1, E2) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
E2: FromRequestParts + Send + 'static,
Handler for functions with two extractors
impl<F, Fut, Res, E1, E2> Handler<(E1, E2)> for Fwhere
F: Fn(E1, E2) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
E2: FromRequestParts + Send + 'static,
Handler for functions with two extractors
Source§impl<F, Fut, Res, E1, E2, E3> Handler<(E1, E2, E3)> for Fwhere
F: Fn(E1, E2, E3) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
E2: FromRequestParts + Send + 'static,
E3: FromRequestParts + Send + 'static,
Handler for functions with three extractors
impl<F, Fut, Res, E1, E2, E3> Handler<(E1, E2, E3)> for Fwhere
F: Fn(E1, E2, E3) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
E2: FromRequestParts + Send + 'static,
E3: FromRequestParts + Send + 'static,
Handler for functions with three extractors
Source§impl<F, Fut, Res, E1, E2, E3, E4> Handler<(E1, E2, E3, E4)> for Fwhere
F: Fn(E1, E2, E3, E4) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
E2: FromRequestParts + Send + 'static,
E3: FromRequestParts + Send + 'static,
E4: FromRequestParts + Send + 'static,
Handler for functions with four extractors
impl<F, Fut, Res, E1, E2, E3, E4> Handler<(E1, E2, E3, E4)> for Fwhere
F: Fn(E1, E2, E3, E4) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Res> + Send + 'static,
Res: IntoResponse,
E1: FromRequestParts + Send + 'static,
E2: FromRequestParts + Send + 'static,
E3: FromRequestParts + Send + 'static,
E4: FromRequestParts + Send + 'static,
Handler for functions with four extractors