mirror of https://github.com/fafhrd91/actix-web
update deps. remove dead code
This commit is contained in:
parent
3239dab8ea
commit
3eeccc604c
|
@ -3,6 +3,7 @@
|
|||
## Unreleased - 2020-xx-xx
|
||||
### Changed
|
||||
* Bumped `rand` to `0.8`
|
||||
* Update `rust-tls` to `0.19.0`
|
||||
|
||||
### Fixed
|
||||
* added the actual parsing error to `test::read_body_json` [#1812]
|
||||
|
|
14
Cargo.toml
14
Cargo.toml
|
@ -91,9 +91,9 @@ awc = { version = "2.0.3", default-features = false }
|
|||
bytes = "1"
|
||||
derive_more = "0.99.5"
|
||||
encoding_rs = "0.8"
|
||||
futures-channel = { version = "0.3.5", default-features = false }
|
||||
futures-core = { version = "0.3.5", default-features = false }
|
||||
futures-util = { version = "0.3.5", default-features = false }
|
||||
futures-channel = { version = "0.3.7", default-features = false }
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
fxhash = "0.2.1"
|
||||
log = "0.4"
|
||||
mime = "0.3"
|
||||
|
@ -106,7 +106,7 @@ serde_urlencoded = "0.7"
|
|||
time = { version = "0.2.7", default-features = false, features = ["std"] }
|
||||
url = "2.1"
|
||||
open-ssl = { package = "openssl", version = "0.10", optional = true }
|
||||
rust-tls = { package = "rustls", version = "0.18.0", optional = true }
|
||||
rust-tls = { package = "rustls", version = "0.19.0", optional = true }
|
||||
tinyvec = { version = "1", features = ["alloc"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -138,10 +138,14 @@ actix = { git = "https://github.com/fakeshadow/actix.git", branch = "tokio-0.3"
|
|||
actix-rt = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
actix-server = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
actix-tls = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
actix-connect = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
#actix-connect = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
actix-connect = { path = "../actix-net-fs/actix-connect" }
|
||||
actix-utils = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
actix-codec = { git = "https://github.com/fakeshadow/actix-net.git", branch = "mio-0.7.3" }
|
||||
|
||||
http = { git = "https://github.com/fakeshadow/http.git" }
|
||||
trust-dns-proto = { git = "https://github.com/messense/trust-dns.git", branch = "tokio-1" }
|
||||
trust-dns-resolver = { git = "https://github.com/messense/trust-dns.git", branch = "tokio-1" }
|
||||
|
||||
[[bench]]
|
||||
name = "server"
|
||||
|
|
|
@ -40,7 +40,7 @@ awc = "2.0.0"
|
|||
|
||||
base64 = "0.13"
|
||||
bytes = "1"
|
||||
futures-core = { version = "0.3.5", default-features = false }
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
http = "0.2.2"
|
||||
log = "0.4"
|
||||
socket2 = "0.3"
|
||||
|
|
|
@ -25,7 +25,6 @@ pub enum ConnectError {
|
|||
// #[cfg(feature = "openssl")]
|
||||
// #[display(fmt = "{}", _0)]
|
||||
// SslHandshakeError(SslError),
|
||||
|
||||
/// Failed to resolve the hostname
|
||||
#[display(fmt = "Failed resolving hostname: {}", _0)]
|
||||
Resolver(ResolveError),
|
||||
|
|
|
@ -108,7 +108,6 @@ where
|
|||
messages: VecDeque<DispatcherMessage>,
|
||||
|
||||
ka_expire: Instant,
|
||||
|
||||
#[pin]
|
||||
ka_timer: Option<Sleep>,
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ pub use self::codec::Codec;
|
|||
pub use self::dispatcher::Dispatcher;
|
||||
pub use self::expect::ExpectHandler;
|
||||
pub use self::payload::Payload;
|
||||
pub use self::service::{H1Service, H1ServiceHandler, OneRequest};
|
||||
pub use self::service::{H1Service, H1ServiceHandler};
|
||||
pub use self::upgrade::UpgradeHandler;
|
||||
pub use self::utils::SendResponse;
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ use actix_codec::{AsyncRead, AsyncWrite, Framed};
|
|||
use actix_rt::net::TcpStream;
|
||||
use actix_service::{pipeline_factory, IntoServiceFactory, Service, ServiceFactory};
|
||||
use futures_core::ready;
|
||||
use futures_util::future::{ok, Ready};
|
||||
use futures_util::future::ready;
|
||||
|
||||
use crate::body::MessageBody;
|
||||
use crate::cloneable::CloneableService;
|
||||
use crate::config::ServiceConfig;
|
||||
use crate::error::{DispatchError, Error, ParseError};
|
||||
use crate::error::{DispatchError, Error};
|
||||
use crate::helpers::DataFactory;
|
||||
use crate::request::Request;
|
||||
use crate::response::Response;
|
||||
|
@ -22,7 +22,7 @@ use crate::{ConnectCallback, Extensions};
|
|||
|
||||
use super::codec::Codec;
|
||||
use super::dispatcher::Dispatcher;
|
||||
use super::{ExpectHandler, Message, UpgradeHandler};
|
||||
use super::{ExpectHandler, UpgradeHandler};
|
||||
|
||||
/// `ServiceFactory` implementation for HTTP1 transport
|
||||
pub struct H1Service<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> {
|
||||
|
@ -90,7 +90,7 @@ where
|
|||
> {
|
||||
pipeline_factory(|io: TcpStream| {
|
||||
let peer_addr = io.peer_addr().ok();
|
||||
ok((io, peer_addr))
|
||||
ready(Ok((io, peer_addr)))
|
||||
})
|
||||
.and_then(self)
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ mod openssl {
|
|||
)
|
||||
.and_then(|io: SslStream<TcpStream>| {
|
||||
let peer_addr = io.get_ref().peer_addr().ok();
|
||||
ok((io, peer_addr))
|
||||
ready(Ok((io, peer_addr)))
|
||||
})
|
||||
.and_then(self.map_err(TlsError::Service))
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ mod rustls {
|
|||
)
|
||||
.and_then(|io: TlsStream<TcpStream>| {
|
||||
let peer_addr = io.get_ref().0.peer_addr().ok();
|
||||
ok((io, peer_addr))
|
||||
ready(Ok((io, peer_addr)))
|
||||
})
|
||||
.and_then(self.map_err(TlsError::Service))
|
||||
}
|
||||
|
@ -500,103 +500,3 @@ where
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// `ServiceFactory` implementation for `OneRequestService` service
|
||||
#[derive(Default)]
|
||||
pub struct OneRequest<T> {
|
||||
config: ServiceConfig,
|
||||
_t: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T> OneRequest<T>
|
||||
where
|
||||
T: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
/// Create new `H1SimpleService` instance.
|
||||
pub fn new() -> Self {
|
||||
OneRequest {
|
||||
config: ServiceConfig::default(),
|
||||
_t: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ServiceFactory for OneRequest<T>
|
||||
where
|
||||
T: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
type Config = ();
|
||||
type Request = T;
|
||||
type Response = (Request, Framed<T, Codec>);
|
||||
type Error = ParseError;
|
||||
type InitError = ();
|
||||
type Service = OneRequestService<T>;
|
||||
type Future = Ready<Result<Self::Service, Self::InitError>>;
|
||||
|
||||
fn new_service(&self, _: ()) -> Self::Future {
|
||||
ok(OneRequestService {
|
||||
_t: PhantomData,
|
||||
config: self.config.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// `Service` implementation for HTTP1 transport. Reads one request and returns
|
||||
/// request and framed object.
|
||||
pub struct OneRequestService<T> {
|
||||
_t: PhantomData<T>,
|
||||
config: ServiceConfig,
|
||||
}
|
||||
|
||||
impl<T> Service for OneRequestService<T>
|
||||
where
|
||||
T: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
type Request = T;
|
||||
type Response = (Request, Framed<T, Codec>);
|
||||
type Error = ParseError;
|
||||
type Future = OneRequestServiceResponse<T>;
|
||||
|
||||
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
fn call(&mut self, req: Self::Request) -> Self::Future {
|
||||
OneRequestServiceResponse {
|
||||
framed: Some(Framed::new(req, Codec::new(self.config.clone()))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[pin_project::pin_project]
|
||||
pub struct OneRequestServiceResponse<T>
|
||||
where
|
||||
T: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
#[pin]
|
||||
framed: Option<Framed<T, Codec>>,
|
||||
}
|
||||
|
||||
impl<T> Future for OneRequestServiceResponse<T>
|
||||
where
|
||||
T: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
type Output = Result<(Request, Framed<T, Codec>), ParseError>;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
let this = self.as_mut().project();
|
||||
|
||||
match ready!(this.framed.as_pin_mut().unwrap().next_item(cx)) {
|
||||
Some(Ok(req)) => match req {
|
||||
Message::Item(req) => {
|
||||
let mut this = self.as_mut().project();
|
||||
Poll::Ready(Ok((req, this.framed.take().unwrap())))
|
||||
}
|
||||
Message::Chunk(_) => unreachable!("Something is wrong"),
|
||||
},
|
||||
Some(Err(err)) => Poll::Ready(Err(err)),
|
||||
None => Poll::Ready(Err(ParseError::Incomplete)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ actix-utils = "2.0.0"
|
|||
bytes = "1"
|
||||
derive_more = "0.99.2"
|
||||
httparse = "1.3"
|
||||
futures-util = { version = "0.3.5", default-features = false }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
log = "0.4"
|
||||
mime = "0.3"
|
||||
twoway = "0.2"
|
||||
|
|
|
@ -21,11 +21,11 @@ actix-web = { version = "3.0.0", default-features = false }
|
|||
actix-http = "2.0.0"
|
||||
actix-codec = "0.3.0"
|
||||
bytes = "1"
|
||||
futures-channel = { version = "0.3.5", default-features = false }
|
||||
futures-core = { version = "0.3.5", default-features = false }
|
||||
futures-channel = { version = "0.3.7", default-features = false }
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
pin-project = "1.0.0"
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "1.1.1"
|
||||
env_logger = "0.7"
|
||||
futures-util = { version = "0.3.5", default-features = false }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
|
|
|
@ -21,6 +21,6 @@ proc-macro2 = "1"
|
|||
[dev-dependencies]
|
||||
actix-rt = "1.1.1"
|
||||
actix-web = "3.0.0"
|
||||
futures-util = { version = "0.3.5", default-features = false }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
trybuild = "1"
|
||||
rustversion = "1"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
### Changed
|
||||
* Upgrade `bytes` to `1`.
|
||||
* Bumped `rand` to `0.8`
|
||||
* Update `rust-tls` to `0.19.0`
|
||||
|
||||
|
||||
## 2.0.3 - 2020-11-29
|
||||
|
|
|
@ -46,7 +46,7 @@ base64 = "0.13"
|
|||
bytes = "1"
|
||||
cfg-if = "1.0"
|
||||
derive_more = "0.99.2"
|
||||
futures-core = { version = "0.3.5", default-features = false }
|
||||
futures-core = { version = "0.3.7", default-features = false }
|
||||
log =" 0.4"
|
||||
mime = "0.3"
|
||||
percent-encoding = "2.1"
|
||||
|
@ -55,7 +55,7 @@ serde = "1.0"
|
|||
serde_json = "1.0"
|
||||
serde_urlencoded = "0.7"
|
||||
open-ssl = { version = "0.10", package = "openssl", optional = true }
|
||||
rust-tls = { version = "0.18.0", package = "rustls", optional = true, features = ["dangerous_configuration"] }
|
||||
rust-tls = { version = "0.19.0", package = "rustls", optional = true, features = ["dangerous_configuration"] }
|
||||
|
||||
[dev-dependencies]
|
||||
actix-connect = { version = "2.0.0", features = ["openssl"] }
|
||||
|
@ -67,6 +67,6 @@ actix-server = "1.0.0"
|
|||
actix-tls = { version = "2.0.0", features = ["openssl", "rustls"] }
|
||||
brotli2 = "0.3.2"
|
||||
flate2 = "1.0.13"
|
||||
futures-util = { version = "0.3.5", default-features = false }
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
env_logger = "0.7"
|
||||
webpki = "0.21"
|
||||
|
|
|
@ -15,19 +15,19 @@ use crate::responder::Responder;
|
|||
use crate::service::{ServiceRequest, ServiceResponse};
|
||||
|
||||
/// Async handler converter factory
|
||||
pub trait Factory<T, R, O>: Clone + 'static
|
||||
pub trait Handler<T, R>: Clone + 'static
|
||||
where
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
fn call(&self, param: T) -> R;
|
||||
}
|
||||
|
||||
impl<F, R, O> Factory<(), R, O> for F
|
||||
impl<F, R> Handler<(), R> for F
|
||||
where
|
||||
F: Fn() -> R + Clone + 'static,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
fn call(&self, _: ()) -> R {
|
||||
(self)()
|
||||
|
@ -36,53 +36,53 @@ where
|
|||
|
||||
#[doc(hidden)]
|
||||
/// Extract arguments from request, run factory function and make response.
|
||||
pub struct Handler<F, T, R, O>
|
||||
pub struct HandlerService<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
hnd: F,
|
||||
_t: PhantomData<(T, R, O)>,
|
||||
_t: PhantomData<(T, R)>,
|
||||
}
|
||||
|
||||
impl<F, T, R, O> Handler<F, T, R, O>
|
||||
impl<F, T, R> HandlerService<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
pub fn new(hnd: F) -> Self {
|
||||
Handler {
|
||||
HandlerService {
|
||||
hnd,
|
||||
_t: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, T, R, O> Clone for Handler<F, T, R, O>
|
||||
impl<F, T, R> Clone for HandlerService<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
Handler {
|
||||
HandlerService {
|
||||
hnd: self.hnd.clone(),
|
||||
_t: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, T, R, O> ServiceFactory for Handler<F, T, R, O>
|
||||
impl<F, T, R> ServiceFactory for HandlerService<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
type Request = ServiceRequest;
|
||||
type Response = ServiceResponse;
|
||||
|
@ -98,17 +98,17 @@ where
|
|||
}
|
||||
|
||||
// Handler is both it's ServiceFactory and Service Type.
|
||||
impl<F, T, R, O> Service for Handler<F, T, R, O>
|
||||
impl<F, T, R> Service for HandlerService<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
type Request = ServiceRequest;
|
||||
type Response = ServiceResponse;
|
||||
type Error = Error;
|
||||
type Future = HandlerServiceFuture<F, T, R, O>;
|
||||
type Future = HandlerServiceFuture<F, T, R>;
|
||||
|
||||
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||
Poll::Ready(Ok(()))
|
||||
|
@ -123,24 +123,24 @@ where
|
|||
|
||||
#[doc(hidden)]
|
||||
#[pin_project(project = HandlerProj)]
|
||||
pub enum HandlerServiceFuture<F, T, R, O>
|
||||
pub enum HandlerServiceFuture<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
Extract(#[pin] T::Future, Option<HttpRequest>, F),
|
||||
Handle(#[pin] R, Option<HttpRequest>),
|
||||
Respond(#[pin] O::Future, Option<HttpRequest>),
|
||||
Respond(#[pin] <R::Output as Responder>::Future, Option<HttpRequest>),
|
||||
}
|
||||
|
||||
impl<F, T, R, O> Future for HandlerServiceFuture<F, T, R, O>
|
||||
impl<F, T, R> Future for HandlerServiceFuture<F, T, R>
|
||||
where
|
||||
F: Factory<T, R, O>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest,
|
||||
R: Future<Output = O>,
|
||||
O: Responder,
|
||||
R: Future,
|
||||
R::Output: Responder,
|
||||
{
|
||||
// Error type in this future is a placeholder type.
|
||||
// all instances of error must be converted to ServiceResponse and return in Ok.
|
||||
|
@ -181,10 +181,10 @@ where
|
|||
|
||||
/// FromRequest trait impl for tuples
|
||||
macro_rules! factory_tuple ({ $(($n:tt, $T:ident)),+} => {
|
||||
impl<Func, $($T,)+ Res, O> Factory<($($T,)+), Res, O> for Func
|
||||
impl<Func, $($T,)+ Res> Handler<($($T,)+), Res> for Func
|
||||
where Func: Fn($($T,)+) -> Res + Clone + 'static,
|
||||
Res: Future<Output = O>,
|
||||
O: Responder,
|
||||
Res: Future,
|
||||
Res::Output: Responder,
|
||||
{
|
||||
fn call(&self, param: ($($T,)+)) -> Res {
|
||||
(self)($(param.$n,)+)
|
||||
|
|
|
@ -121,7 +121,7 @@ pub mod dev {
|
|||
|
||||
pub use crate::config::{AppConfig, AppService};
|
||||
#[doc(hidden)]
|
||||
pub use crate::handler::Factory;
|
||||
pub use crate::handler::Handler;
|
||||
pub use crate::info::ConnectionInfo;
|
||||
pub use crate::rmap::ResourceMap;
|
||||
pub use crate::service::{
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::data::Data;
|
|||
use crate::dev::{insert_slash, AppService, HttpServiceFactory, ResourceDef};
|
||||
use crate::extract::FromRequest;
|
||||
use crate::guard::Guard;
|
||||
use crate::handler::Factory;
|
||||
use crate::handler::Handler;
|
||||
use crate::responder::Responder;
|
||||
use crate::route::{CreateRouteService, Route, RouteService};
|
||||
use crate::service::{ServiceRequest, ServiceResponse};
|
||||
|
@ -227,12 +227,12 @@ where
|
|||
/// # fn index(req: HttpRequest) -> HttpResponse { unimplemented!() }
|
||||
/// App::new().service(web::resource("/").route(web::route().to(index)));
|
||||
/// ```
|
||||
pub fn to<F, I, R, U>(mut self, handler: F) -> Self
|
||||
pub fn to<F, I, R>(mut self, handler: F) -> Self
|
||||
where
|
||||
F: Factory<I, R, U>,
|
||||
F: Handler<I, R>,
|
||||
I: FromRequest + 'static,
|
||||
R: Future<Output = U> + 'static,
|
||||
U: Responder + 'static,
|
||||
R: Future + 'static,
|
||||
R::Output: Responder + 'static,
|
||||
{
|
||||
self.routes.push(Route::new().to(handler));
|
||||
self
|
||||
|
|
14
src/route.rs
14
src/route.rs
|
@ -11,7 +11,7 @@ use futures_util::future::{ready, FutureExt, LocalBoxFuture};
|
|||
|
||||
use crate::extract::FromRequest;
|
||||
use crate::guard::{self, Guard};
|
||||
use crate::handler::{Factory, Handler};
|
||||
use crate::handler::{Handler, HandlerService};
|
||||
use crate::responder::Responder;
|
||||
use crate::service::{ServiceRequest, ServiceResponse};
|
||||
use crate::HttpResponse;
|
||||
|
@ -51,7 +51,7 @@ impl Route {
|
|||
#[allow(clippy::new_without_default)]
|
||||
pub fn new() -> Route {
|
||||
Route {
|
||||
service: Box::new(RouteNewService::new(Handler::new(|| {
|
||||
service: Box::new(RouteNewService::new(HandlerService::new(|| {
|
||||
ready(HttpResponse::NotFound())
|
||||
}))),
|
||||
guards: Rc::new(Vec::new()),
|
||||
|
@ -219,14 +219,14 @@ impl Route {
|
|||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
pub fn to<F, T, R, U>(mut self, handler: F) -> Self
|
||||
pub fn to<F, T, R>(mut self, handler: F) -> Self
|
||||
where
|
||||
F: Factory<T, R, U>,
|
||||
F: Handler<T, R>,
|
||||
T: FromRequest + 'static,
|
||||
R: Future<Output = U> + 'static,
|
||||
U: Responder + 'static,
|
||||
R: Future + 'static,
|
||||
R::Output: Responder + 'static,
|
||||
{
|
||||
self.service = Box::new(RouteNewService::new(Handler::new(handler)));
|
||||
self.service = Box::new(RouteNewService::new(HandlerService::new(handler)));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
10
src/web.rs
10
src/web.rs
|
@ -9,7 +9,7 @@ pub use futures_channel::oneshot::Canceled;
|
|||
|
||||
use crate::error::BlockingError;
|
||||
use crate::extract::FromRequest;
|
||||
use crate::handler::Factory;
|
||||
use crate::handler::Handler;
|
||||
use crate::resource::Resource;
|
||||
use crate::responder::Responder;
|
||||
use crate::route::Route;
|
||||
|
@ -244,12 +244,12 @@ pub fn method(method: Method) -> Route {
|
|||
/// web::to(index))
|
||||
/// );
|
||||
/// ```
|
||||
pub fn to<F, I, R, U>(handler: F) -> Route
|
||||
pub fn to<F, I, R>(handler: F) -> Route
|
||||
where
|
||||
F: Factory<I, R, U>,
|
||||
F: Handler<I, R>,
|
||||
I: FromRequest + 'static,
|
||||
R: Future<Output = U> + 'static,
|
||||
U: Responder + 'static,
|
||||
R: Future + 'static,
|
||||
R::Output: Responder + 'static,
|
||||
{
|
||||
Route::new().to(handler)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue