pub trait IntoHandler<Args>:
Clone
+ Send
+ Sync
+ 'static {
type Handler: Handler;
// Required method
fn into_handler(self) -> Self::Handler;
}Expand description
Trait for converting various function types into handlers.
This enables ergonomic handler registration:
ⓘ
router.get("/", my_handler); // Works for any IntoHandlerRequired Associated Types§
Required Methods§
Sourcefn into_handler(self) -> Self::Handler
fn into_handler(self) -> Self::Handler
Convert into a handler.
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> IntoHandler<(HttpRequest,)> for Fwhere
F: Fn(HttpRequest) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Result<HttpResponse, Error>> + Send + 'static,
Implement IntoHandler for async functions.
impl<F, Fut> IntoHandler<(HttpRequest,)> for Fwhere
F: Fn(HttpRequest) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = Result<HttpResponse, Error>> + Send + 'static,
Implement IntoHandler for async functions.