1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::{FromRequest, IntoResponse, Request, Result};
use super::{FnExt, FnExtHandler, Handler};
pub trait IntoHandler<E, I> {
type Handler: Handler<I>;
#[must_use]
fn into_handler(self) -> Self::Handler;
}
impl<H, E, O> IntoHandler<E, Request> for H
where
E: FromRequest + Send + Sync + 'static,
E::Error: IntoResponse + Send + Sync,
H: FnExt<E, Output = Result<O>>,
O: Send + Sync + 'static,
{
type Handler = FnExtHandler<H, E, O>;
fn into_handler(self) -> Self::Handler {
FnExtHandler::new(self)
}
}