1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00

remove some static contraints

This commit is contained in:
Nikolay Kim 2019-04-04 10:59:34 -07:00
parent dc7c3d37a1
commit bc834f6a03
15 changed files with 84 additions and 84 deletions

View File

@ -51,7 +51,7 @@ secure-cookies = ["ring"]
actix-service = "0.3.4" actix-service = "0.3.4"
actix-codec = "0.1.2" actix-codec = "0.1.2"
actix-connect = "0.1.0" actix-connect = "0.1.0"
actix-utils = "0.3.4" actix-utils = "0.3.5"
actix-server-config = "0.1.0" actix-server-config = "0.1.0"
actix-threadpool = "0.1.0" actix-threadpool = "0.1.0"

View File

@ -2,7 +2,7 @@ use std::fmt::Debug;
use std::marker::PhantomData; use std::marker::PhantomData;
use actix_server_config::ServerConfig as SrvConfig; use actix_server_config::ServerConfig as SrvConfig;
use actix_service::{IntoNewService, NewService}; use actix_service::{IntoNewService, NewService, Service};
use crate::body::MessageBody; use crate::body::MessageBody;
use crate::config::{KeepAlive, ServiceConfig}; use crate::config::{KeepAlive, ServiceConfig};
@ -27,8 +27,7 @@ pub struct HttpServiceBuilder<T, S> {
impl<T, S> HttpServiceBuilder<T, S> impl<T, S> HttpServiceBuilder<T, S>
where where
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Error: Debug + 'static, S::Error: Debug,
S::Service: 'static,
{ {
/// Create instance of `ServiceConfigBuilder` /// Create instance of `ServiceConfigBuilder`
pub fn new() -> HttpServiceBuilder<T, S> { pub fn new() -> HttpServiceBuilder<T, S> {
@ -115,6 +114,7 @@ where
B: MessageBody + 'static, B: MessageBody + 'static,
F: IntoNewService<S, SrvConfig>, F: IntoNewService<S, SrvConfig>,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
{ {
let cfg = ServiceConfig::new( let cfg = ServiceConfig::new(
self.keep_alive, self.keep_alive,
@ -130,6 +130,7 @@ where
B: MessageBody + 'static, B: MessageBody + 'static,
F: IntoNewService<S, SrvConfig>, F: IntoNewService<S, SrvConfig>,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
{ {
let cfg = ServiceConfig::new( let cfg = ServiceConfig::new(
self.keep_alive, self.keep_alive,

View File

@ -69,7 +69,7 @@ where
} }
} }
impl<T: AsyncRead + AsyncWrite + 'static> IoConnection<T> { impl<T: AsyncRead + AsyncWrite> IoConnection<T> {
pub(crate) fn new( pub(crate) fn new(
io: ConnectionType<T>, io: ConnectionType<T>,
created: time::Instant, created: time::Instant,

View File

@ -37,14 +37,14 @@ bitflags! {
} }
/// Dispatcher for HTTP/1.1 protocol /// Dispatcher for HTTP/1.1 protocol
pub struct Dispatcher<T, S: Service<Request = Request> + 'static, B: MessageBody> pub struct Dispatcher<T, S: Service<Request = Request>, B: MessageBody>
where where
S::Error: Debug, S::Error: Debug,
{ {
inner: Option<InnerDispatcher<T, S, B>>, inner: Option<InnerDispatcher<T, S, B>>,
} }
struct InnerDispatcher<T, S: Service<Request = Request> + 'static, B: MessageBody> struct InnerDispatcher<T, S: Service<Request = Request>, B: MessageBody>
where where
S::Error: Debug, S::Error: Debug,
{ {
@ -86,7 +86,7 @@ impl<S: Service<Request = Request>, B: MessageBody> State<S, B> {
impl<T, S, B> Dispatcher<T, S, B> impl<T, S, B> Dispatcher<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
@ -144,7 +144,7 @@ where
impl<T, S, B> InnerDispatcher<T, S, B> impl<T, S, B> InnerDispatcher<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,

View File

@ -30,7 +30,6 @@ where
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
S::Service: 'static,
B: MessageBody, B: MessageBody,
{ {
/// Create new `HttpService` instance with default config. /// Create new `HttpService` instance with default config.
@ -63,7 +62,6 @@ where
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
S::Service: 'static,
B: MessageBody, B: MessageBody,
{ {
type Request = Io<T, P>; type Request = Io<T, P>;
@ -93,7 +91,6 @@ impl<T, P, S, B> Future for H1ServiceResponse<T, P, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
@ -111,7 +108,7 @@ where
} }
/// `Service` implementation for HTTP1 transport /// `Service` implementation for HTTP1 transport
pub struct H1ServiceHandler<T, P, S: 'static, B> { pub struct H1ServiceHandler<T, P, S, B> {
srv: CloneableService<S>, srv: CloneableService<S>,
cfg: ServiceConfig, cfg: ServiceConfig,
_t: PhantomData<(T, P, B)>, _t: PhantomData<(T, P, B)>,

View File

@ -31,7 +31,7 @@ const CHUNK_SIZE: usize = 16_384;
/// Dispatcher for HTTP/2 protocol /// Dispatcher for HTTP/2 protocol
pub struct Dispatcher< pub struct Dispatcher<
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
B: MessageBody, B: MessageBody,
> { > {
service: CloneableService<S>, service: CloneableService<S>,
@ -45,8 +45,9 @@ pub struct Dispatcher<
impl<T, S, B> Dispatcher<T, S, B> impl<T, S, B> Dispatcher<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: fmt::Debug, S::Error: fmt::Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -86,8 +87,9 @@ where
impl<T, S, B> Future for Dispatcher<T, S, B> impl<T, S, B> Future for Dispatcher<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: fmt::Debug, S::Error: fmt::Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -115,7 +117,7 @@ where
head.method = parts.method; head.method = parts.method;
head.version = parts.version; head.version = parts.version;
head.headers = parts.headers; head.headers = parts.headers;
tokio_current_thread::spawn(ServiceResponse::<S, B> { tokio_current_thread::spawn(ServiceResponse::<S::Future, B> {
state: ServiceResponseState::ServiceCall( state: ServiceResponseState::ServiceCall(
self.service.call(req), self.service.call(req),
Some(res), Some(res),
@ -130,22 +132,22 @@ where
} }
} }
struct ServiceResponse<S: Service, B> { struct ServiceResponse<F, B> {
state: ServiceResponseState<S, B>, state: ServiceResponseState<F, B>,
config: ServiceConfig, config: ServiceConfig,
buffer: Option<Bytes>, buffer: Option<Bytes>,
} }
enum ServiceResponseState<S: Service, B> { enum ServiceResponseState<F, B> {
ServiceCall(S::Future, Option<SendResponse<Bytes>>), ServiceCall(F, Option<SendResponse<Bytes>>),
SendPayload(SendStream<Bytes>, ResponseBody<B>), SendPayload(SendStream<Bytes>, ResponseBody<B>),
} }
impl<S, B> ServiceResponse<S, B> impl<F, B> ServiceResponse<F, B>
where where
S: Service<Request = Request> + 'static, F: Future,
S::Error: fmt::Debug, F::Error: fmt::Debug,
S::Response: Into<Response<B>>, F::Item: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
fn prepare_response( fn prepare_response(
@ -209,11 +211,11 @@ where
} }
} }
impl<S, B> Future for ServiceResponse<S, B> impl<F, B> Future for ServiceResponse<F, B>
where where
S: Service<Request = Request> + 'static, F: Future,
S::Error: fmt::Debug, F::Error: fmt::Debug,
S::Response: Into<Response<B>>, F::Item: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
type Item = (); type Item = ();

View File

@ -32,9 +32,9 @@ pub struct H2Service<T, P, S, B> {
impl<T, P, S, B> H2Service<T, P, S, B> impl<T, P, S, B> H2Service<T, P, S, B>
where where
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static, S::Error: Debug,
S::Error: Debug + 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
/// Create new `HttpService` instance. /// Create new `HttpService` instance.
@ -65,9 +65,9 @@ impl<T, P, S, B> NewService<SrvConfig> for H2Service<T, P, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
type Request = Io<T, P>; type Request = Io<T, P>;
@ -97,9 +97,9 @@ impl<T, P, S, B> Future for H2ServiceResponse<T, P, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static,
S::Response: Into<Response<B>>,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
type Item = H2ServiceHandler<T, P, S::Service, B>; type Item = H2ServiceHandler<T, P, S::Service, B>;
@ -115,7 +115,7 @@ where
} }
/// `Service` implementation for http/2 transport /// `Service` implementation for http/2 transport
pub struct H2ServiceHandler<T, P, S: 'static, B> { pub struct H2ServiceHandler<T, P, S, B> {
srv: CloneableService<S>, srv: CloneableService<S>,
cfg: ServiceConfig, cfg: ServiceConfig,
_t: PhantomData<(T, P, B)>, _t: PhantomData<(T, P, B)>,
@ -123,8 +123,9 @@ pub struct H2ServiceHandler<T, P, S: 'static, B> {
impl<T, P, S, B> H2ServiceHandler<T, P, S, B> impl<T, P, S, B> H2ServiceHandler<T, P, S, B>
where where
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -140,8 +141,9 @@ where
impl<T, P, S, B> Service for H2ServiceHandler<T, P, S, B> impl<T, P, S, B> Service for H2ServiceHandler<T, P, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -168,11 +170,10 @@ where
} }
} }
enum State< enum State<T: AsyncRead + AsyncWrite, S: Service<Request = Request>, B: MessageBody>
T: AsyncRead + AsyncWrite, where
S: Service<Request = Request> + 'static, S::Future: 'static,
B: MessageBody, {
> {
Incoming(Dispatcher<T, S, B>), Incoming(Dispatcher<T, S, B>),
Handshake( Handshake(
Option<CloneableService<S>>, Option<CloneableService<S>>,
@ -184,8 +185,9 @@ enum State<
pub struct H2ServiceHandlerResponse<T, S, B> pub struct H2ServiceHandlerResponse<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -195,8 +197,9 @@ where
impl<T, S, B> Future for H2ServiceHandlerResponse<T, S, B> impl<T, S, B> Future for H2ServiceHandlerResponse<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
{ {

View File

@ -29,9 +29,9 @@ pub struct HttpService<T, P, S, B> {
impl<T, S, B> HttpService<T, (), S, B> impl<T, S, B> HttpService<T, (), S, B>
where where
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static, S::Error: Debug,
S::Error: Debug + 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
/// Create builder for `HttpService` instance. /// Create builder for `HttpService` instance.
@ -43,9 +43,9 @@ where
impl<T, P, S, B> HttpService<T, P, S, B> impl<T, P, S, B> HttpService<T, P, S, B>
where where
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static, S::Error: Debug,
S::Error: Debug + 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
/// Create new `HttpService` instance. /// Create new `HttpService` instance.
@ -74,11 +74,11 @@ where
impl<T, P, S, B> NewService<SrvConfig> for HttpService<T, P, S, B> impl<T, P, S, B> NewService<SrvConfig> for HttpService<T, P, S, B>
where where
T: AsyncRead + AsyncWrite + 'static, T: AsyncRead + AsyncWrite,
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
type Request = ServerIo<T, P>; type Request = ServerIo<T, P>;
@ -108,9 +108,9 @@ impl<T, P, S, B> Future for HttpServiceResponse<T, P, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: NewService<SrvConfig, Request = Request>, S: NewService<SrvConfig, Request = Request>,
S::Service: 'static,
S::Response: Into<Response<B>>,
S::Error: Debug, S::Error: Debug,
S::Response: Into<Response<B>>,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
type Item = HttpServiceHandler<T, P, S::Service, B>; type Item = HttpServiceHandler<T, P, S::Service, B>;
@ -126,7 +126,7 @@ where
} }
/// `Service` implementation for http transport /// `Service` implementation for http transport
pub struct HttpServiceHandler<T, P, S: 'static, B> { pub struct HttpServiceHandler<T, P, S, B> {
srv: CloneableService<S>, srv: CloneableService<S>,
cfg: ServiceConfig, cfg: ServiceConfig,
_t: PhantomData<(T, P, B)>, _t: PhantomData<(T, P, B)>,
@ -134,8 +134,9 @@ pub struct HttpServiceHandler<T, P, S: 'static, B> {
impl<T, P, S, B> HttpServiceHandler<T, P, S, B> impl<T, P, S, B> HttpServiceHandler<T, P, S, B>
where where
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -150,9 +151,10 @@ where
impl<T, P, S, B> Service for HttpServiceHandler<T, P, S, B> impl<T, P, S, B> Service for HttpServiceHandler<T, P, S, B>
where where
T: AsyncRead + AsyncWrite + 'static, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -203,10 +205,11 @@ where
} }
} }
enum State<T, S: Service<Request = Request> + 'static, B: MessageBody> enum State<T, S: Service<Request = Request>, B: MessageBody>
where where
S::Future: 'static,
S::Error: fmt::Debug, S::Error: fmt::Debug,
T: AsyncRead + AsyncWrite + 'static, T: AsyncRead + AsyncWrite,
{ {
H1(h1::Dispatcher<T, S, B>), H1(h1::Dispatcher<T, S, B>),
H2(Dispatcher<Io<T>, S, B>), H2(Dispatcher<Io<T>, S, B>),
@ -216,9 +219,10 @@ where
pub struct HttpServiceHandlerResponse<T, S, B> pub struct HttpServiceHandlerResponse<T, S, B>
where where
T: AsyncRead + AsyncWrite + 'static, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
@ -230,8 +234,9 @@ const HTTP2_PREFACE: [u8; 14] = *b"PRI * HTTP/2.0";
impl<T, S, B> Future for HttpServiceHandlerResponse<T, S, B> impl<T, S, B> Future for HttpServiceHandlerResponse<T, S, B>
where where
T: AsyncRead + AsyncWrite, T: AsyncRead + AsyncWrite,
S: Service<Request = Request> + 'static, S: Service<Request = Request>,
S::Error: Debug, S::Error: Debug,
S::Future: 'static,
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
{ {
@ -331,13 +336,13 @@ impl<T: io::Write> io::Write for Io<T> {
} }
} }
impl<T: AsyncRead + 'static> AsyncRead for Io<T> { impl<T: AsyncRead> AsyncRead for Io<T> {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool { unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool {
self.inner.prepare_uninitialized_buffer(buf) self.inner.prepare_uninitialized_buffer(buf)
} }
} }
impl<T: AsyncWrite + 'static> AsyncWrite for Io<T> { impl<T: AsyncWrite> AsyncWrite for Io<T> {
fn shutdown(&mut self) -> Poll<(), io::Error> { fn shutdown(&mut self) -> Poll<(), io::Error> {
self.inner.shutdown() self.inner.shutdown()
} }

View File

@ -38,7 +38,7 @@ flate2-rust = ["actix-http/flate2-rust"]
[dependencies] [dependencies]
actix-codec = "0.1.1" actix-codec = "0.1.1"
actix-service = "0.3.4" actix-service = "0.3.4"
actix-http = "0.1.0-alpa.3" actix-http = "0.1.0-alpha.3"
base64 = "0.10.1" base64 = "0.10.1"
bytes = "0.4" bytes = "0.4"
derive_more = "0.14" derive_more = "0.14"
@ -56,7 +56,7 @@ openssl = { version="0.10", optional = true }
[dev-dependencies] [dev-dependencies]
actix-rt = "0.2.2" actix-rt = "0.2.2"
actix-web = { version = "1.0.0-alpha.3", features=["ssl"] } actix-web = { version = "1.0.0-alpha.3", features=["ssl"] }
actix-http = { version = "0.1.0-alpa.3", features=["ssl"] } actix-http = { version = "0.1.0-alpha.3", features=["ssl"] }
actix-http-test = { version = "0.1.0-alpha.3", features=["ssl"] } actix-http-test = { version = "0.1.0-alpha.3", features=["ssl"] }
actix-utils = "0.3.4" actix-utils = "0.3.4"
actix-server = { version = "0.4.1", features=["ssl"] } actix-server = { version = "0.4.1", features=["ssl"] }

View File

@ -282,7 +282,7 @@ where
impl<T, U> Future for JsonBody<T, U> impl<T, U> Future for JsonBody<T, U>
where where
T: Stream<Item = Bytes, Error = PayloadError>, T: Stream<Item = Bytes, Error = PayloadError>,
U: DeserializeOwned + 'static, U: DeserializeOwned,
{ {
type Item = U; type Item = U;
type Error = JsonPayloadError; type Error = JsonPayloadError;

View File

@ -70,7 +70,7 @@ impl WebsocketsRequest {
/// Set supported websocket protocols /// Set supported websocket protocols
pub fn protocols<U, V>(mut self, protos: U) -> Self pub fn protocols<U, V>(mut self, protos: U) -> Self
where where
U: IntoIterator<Item = V> + 'static, U: IntoIterator<Item = V>,
V: AsRef<str>, V: AsRef<str>,
{ {
let mut protos = protos let mut protos = protos

View File

@ -70,10 +70,8 @@ impl Default for Compress {
impl<S, P, B> Transform<S> for Compress impl<S, P, B> Transform<S> for Compress
where where
P: 'static,
B: MessageBody, B: MessageBody,
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>,
S::Future: 'static,
{ {
type Request = ServiceRequest<P>; type Request = ServiceRequest<P>;
type Response = ServiceResponse<Encoder<B>>; type Response = ServiceResponse<Encoder<B>>;
@ -97,10 +95,8 @@ pub struct CompressMiddleware<S> {
impl<S, P, B> Service for CompressMiddleware<S> impl<S, P, B> Service for CompressMiddleware<S>
where where
P: 'static,
B: MessageBody, B: MessageBody,
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>,
S::Future: 'static,
{ {
type Request = ServiceRequest<P>; type Request = ServiceRequest<P>;
type Response = ServiceResponse<Encoder<B>>; type Response = ServiceResponse<Encoder<B>>;
@ -134,10 +130,8 @@ where
#[doc(hidden)] #[doc(hidden)]
pub struct CompressResponse<S, P, B> pub struct CompressResponse<S, P, B>
where where
P: 'static,
B: MessageBody,
S: Service, S: Service,
S::Future: 'static, B: MessageBody,
{ {
fut: S::Future, fut: S::Future,
encoding: ContentEncoding, encoding: ContentEncoding,
@ -146,10 +140,8 @@ where
impl<S, P, B> Future for CompressResponse<S, P, B> impl<S, P, B> Future for CompressResponse<S, P, B>
where where
P: 'static,
B: MessageBody, B: MessageBody,
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>,
S::Future: 'static,
{ {
type Item = ServiceResponse<Encoder<B>>; type Item = ServiceResponse<Encoder<B>>;
type Error = S::Error; type Error = S::Error;

View File

@ -477,8 +477,9 @@ fn cors<'a>(
impl<S, P, B> IntoTransform<CorsFactory, S> for Cors impl<S, P, B> IntoTransform<CorsFactory, S> for Cors
where where
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>> + 'static, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>,
P: 'static, S::Future: 'static,
S::Error: 'static,
B: 'static, B: 'static,
{ {
fn into_transform(self) -> CorsFactory { fn into_transform(self) -> CorsFactory {
@ -541,7 +542,6 @@ where
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>,
S::Future: 'static, S::Future: 'static,
S::Error: 'static, S::Error: 'static,
P: 'static,
B: 'static, B: 'static,
{ {
type Request = ServiceRequest<P>; type Request = ServiceRequest<P>;
@ -683,7 +683,6 @@ where
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>>,
S::Future: 'static, S::Future: 'static,
S::Error: 'static, S::Error: 'static,
P: 'static,
B: 'static, B: 'static,
{ {
type Request = ServiceRequest<P>; type Request = ServiceRequest<P>;
@ -826,7 +825,6 @@ mod tests {
+ 'static, + 'static,
S::Future: 'static, S::Future: 'static,
S::Error: 'static, S::Error: 'static,
P: 'static,
B: 'static, B: 'static,
{ {
block_on( block_on(

View File

@ -202,10 +202,11 @@ impl<T> IdentityService<T> {
impl<S, T, P, B> Transform<S> for IdentityService<T> impl<S, T, P, B> Transform<S> for IdentityService<T>
where where
P: 'static,
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>> + 'static, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>> + 'static,
S::Future: 'static, S::Future: 'static,
S::Error: 'static,
T: IdentityPolicy, T: IdentityPolicy,
P: 'static,
B: 'static, B: 'static,
{ {
type Request = ServiceRequest<P>; type Request = ServiceRequest<P>;
@ -235,6 +236,7 @@ where
B: 'static, B: 'static,
S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>> + 'static, S: Service<Request = ServiceRequest<P>, Response = ServiceResponse<B>> + 'static,
S::Future: 'static, S::Future: 'static,
S::Error: 'static,
T: IdentityPolicy, T: IdentityPolicy,
{ {
type Request = ServiceRequest<P>; type Request = ServiceRequest<P>;

View File

@ -55,5 +55,5 @@ tokio-timer = "0.2"
openssl = { version="0.10", optional = true } openssl = { version="0.10", optional = true }
[dev-dependencies] [dev-dependencies]
actix-web = "1.0.0-alpa.3" actix-web = "1.0.0-alpha.3"
actix-http = "0.1.0-alpa.3" actix-http = "0.1.0-alpha.3"