1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-12-03 19:42:13 +01:00

update tests

This commit is contained in:
Nikolay Kim 2018-12-06 14:53:55 -08:00
parent 8fe7ce533c
commit e8aa73a44b
10 changed files with 23 additions and 23 deletions

View File

@ -219,7 +219,7 @@ mod tests {
use std::rc::Rc; use std::rc::Rc;
use super::*; use super::*;
use service::{NewServiceExt, Service, ServiceExt}; use crate::service::{NewServiceExt, Service, ServiceExt};
struct Srv1(Rc<Cell<usize>>); struct Srv1(Rc<Cell<usize>>);
impl Service<&'static str> for Srv1 { impl Service<&'static str> for Srv1 {

View File

@ -17,7 +17,7 @@ where
impl<T, F, In, Out, Request> Apply<T, F, In, Out, Request> impl<T, F, In, Out, Request> Apply<T, F, In, Out, Request>
where where
T: Service<Request>, T: Service<Request>,
F: FnMut(In, &mut T) -> Out, F: Fn(In, &mut T) -> Out,
Out: IntoFuture, Out: IntoFuture,
{ {
/// Create new `Apply` combinator /// Create new `Apply` combinator
@ -47,7 +47,7 @@ where
impl<T, F, In, Out, Request> Service<In> for Apply<T, F, In, Out, Request> impl<T, F, In, Out, Request> Service<In> for Apply<T, F, In, Out, Request>
where where
T: Service<Request, Error = Out::Error>, T: Service<Request, Error = Out::Error>,
F: FnMut(In, &mut T) -> Out, F: Fn(In, &mut T) -> Out,
Out: IntoFuture, Out: IntoFuture,
{ {
type Response = <Out::Future as Future>::Item; type Response = <Out::Future as Future>::Item;
@ -76,7 +76,7 @@ where
impl<T, F, In, Out, Request> ApplyNewService<T, F, In, Out, Request> impl<T, F, In, Out, Request> ApplyNewService<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: Fn(In, &mut T::Service) -> Out,
Out: IntoFuture, Out: IntoFuture,
{ {
/// Create new `ApplyNewService` new service instance /// Create new `ApplyNewService` new service instance
@ -92,7 +92,7 @@ where
impl<T, F, In, Out, Request> Clone for ApplyNewService<T, F, In, Out, Request> impl<T, F, In, Out, Request> Clone for ApplyNewService<T, F, In, Out, Request>
where where
T: NewService<Request> + Clone, T: NewService<Request> + Clone,
F: FnMut(Out, &mut T::Service) -> Out + Clone, F: Fn(Out, &mut T::Service) -> Out + Clone,
Out: IntoFuture, Out: IntoFuture,
{ {
fn clone(&self) -> Self { fn clone(&self) -> Self {
@ -107,7 +107,7 @@ where
impl<T, F, In, Out, Request> NewService<In> for ApplyNewService<T, F, In, Out, Request> impl<T, F, In, Out, Request> NewService<In> for ApplyNewService<T, F, In, Out, Request>
where where
T: NewService<Request, Error = Out::Error>, T: NewService<Request, Error = Out::Error>,
F: FnMut(In, &mut T::Service) -> Out + Clone, F: Fn(In, &mut T::Service) -> Out + Clone,
Out: IntoFuture, Out: IntoFuture,
{ {
type Response = <Out::Future as Future>::Item; type Response = <Out::Future as Future>::Item;
@ -125,7 +125,7 @@ where
pub struct ApplyNewServiceFuture<T, F, In, Out, Request> pub struct ApplyNewServiceFuture<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: Fn(In, &mut T::Service) -> Out,
Out: IntoFuture, Out: IntoFuture,
{ {
fut: T::Future, fut: T::Future,
@ -136,7 +136,7 @@ where
impl<T, F, In, Out, Request> ApplyNewServiceFuture<T, F, In, Out, Request> impl<T, F, In, Out, Request> ApplyNewServiceFuture<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: Fn(In, &mut T::Service) -> Out,
Out: IntoFuture, Out: IntoFuture,
{ {
fn new(fut: T::Future, f: F) -> Self { fn new(fut: T::Future, f: F) -> Self {
@ -151,7 +151,7 @@ where
impl<T, F, In, Out, Request> Future for ApplyNewServiceFuture<T, F, In, Out, Request> impl<T, F, In, Out, Request> Future for ApplyNewServiceFuture<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: Fn(In, &mut T::Service) -> Out,
Out: IntoFuture, Out: IntoFuture,
{ {
type Item = Apply<T::Service, F, In, Out, Request>; type Item = Apply<T::Service, F, In, Out, Request>;
@ -171,7 +171,7 @@ mod tests {
use futures::future::{ok, FutureResult}; use futures::future::{ok, FutureResult};
use futures::{Async, Future, Poll}; use futures::{Async, Future, Poll};
use service::{ use crate::service::{
IntoNewService, IntoService, NewService, NewServiceExt, Service, ServiceExt, IntoNewService, IntoService, NewService, NewServiceExt, Service, ServiceExt,
}; };

View File

@ -159,7 +159,7 @@ mod tests {
use futures::future::{err, FutureResult}; use futures::future::{err, FutureResult};
use super::*; use super::*;
use service::{IntoNewService, NewServiceExt, Service, ServiceExt}; use crate::service::{IntoNewService, NewServiceExt, Service, ServiceExt};
struct Srv; struct Srv;
impl Service<()> for Srv { impl Service<()> for Srv {

View File

@ -189,7 +189,7 @@ mod tests {
use futures::future::{ok, FutureResult}; use futures::future::{ok, FutureResult};
use super::*; use super::*;
use service::{IntoNewService, NewServiceExt, Service, ServiceExt}; use crate::service::{IntoNewService, NewServiceExt, Service, ServiceExt};
struct Srv; struct Srv;
impl Service<()> for Srv { impl Service<()> for Srv {

View File

@ -190,7 +190,7 @@ mod tests {
use futures::future::{err, FutureResult}; use futures::future::{err, FutureResult};
use super::*; use super::*;
use service::{IntoNewService, NewServiceExt, Service, ServiceExt}; use crate::service::{IntoNewService, NewServiceExt, Service, ServiceExt};
struct Srv; struct Srv;

View File

@ -35,7 +35,7 @@ pub trait ServiceExt<Request>: Service<Request> {
Self: Sized, Self: Sized,
T: Service<Req, Error = Out::Error>, T: Service<Req, Error = Out::Error>,
I: IntoService<T, Req>, I: IntoService<T, Req>,
F: FnMut(Self::Response, &mut T) -> Out, F: Fn(Self::Response, &mut T) -> Out,
Out: IntoFuture<Error = Self::Error>, Out: IntoFuture<Error = Self::Error>,
{ {
self.and_then(Apply::new(service.into_service(), f)) self.and_then(Apply::new(service.into_service(), f))
@ -158,7 +158,7 @@ pub trait NewServiceExt<Request>: NewService<Request> {
Self: Sized, Self: Sized,
T: NewService<Req, InitError = Self::InitError, Error = Out::Error>, T: NewService<Req, InitError = Self::InitError, Error = Out::Error>,
I: IntoNewService<T, Req>, I: IntoNewService<T, Req>,
F: FnMut(Self::Response, &mut T::Service) -> Out + Clone, F: Fn(Self::Response, &mut T::Service) -> Out + Clone,
Out: IntoFuture<Error = Self::Error>, Out: IntoFuture<Error = Self::Error>,
{ {
self.and_then(ApplyNewService::new(service, f)) self.and_then(ApplyNewService::new(service, f))

View File

@ -226,7 +226,7 @@ mod tests {
use std::rc::Rc; use std::rc::Rc;
use super::*; use super::*;
use service::{NewServiceExt, ServiceExt}; use crate::service::{NewServiceExt, ServiceExt};
#[derive(Clone)] #[derive(Clone)]
struct Srv1(Rc<Cell<usize>>); struct Srv1(Rc<Cell<usize>>);

View File

@ -6,8 +6,8 @@ use native_tls::{self, Error, HandshakeError, TlsAcceptor};
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use super::MAX_CONN_COUNTER; use super::MAX_CONN_COUNTER;
use counter::{Counter, CounterGuard}; use crate::counter::{Counter, CounterGuard};
use service::{NewService, Service}; use crate::service::{NewService, Service};
/// Support `SSL` connections via native-tls package /// Support `SSL` connections via native-tls package
/// ///

View File

@ -6,9 +6,9 @@ use tokio_io::{AsyncRead, AsyncWrite};
use tokio_openssl::{AcceptAsync, ConnectAsync, SslAcceptorExt, SslConnectorExt, SslStream}; use tokio_openssl::{AcceptAsync, ConnectAsync, SslAcceptorExt, SslConnectorExt, SslStream};
use super::MAX_CONN_COUNTER; use super::MAX_CONN_COUNTER;
use counter::{Counter, CounterGuard}; use crate::counter::{Counter, CounterGuard};
use resolver::RequestHost; use crate::resolver::RequestHost;
use service::{NewService, Service}; use crate::service::{NewService, Service};
/// Support `SSL` connections via openssl package /// Support `SSL` connections via openssl package
/// ///

View File

@ -8,8 +8,8 @@ use tokio_io::{AsyncRead, AsyncWrite};
use tokio_rustls::{Accept, TlsAcceptor, TlsStream}; use tokio_rustls::{Accept, TlsAcceptor, TlsStream};
use super::MAX_CONN_COUNTER; use super::MAX_CONN_COUNTER;
use counter::{Counter, CounterGuard}; use crate::counter::{Counter, CounterGuard};
use service::{NewService, Service}; use crate::service::{NewService, Service};
/// Support `SSL` connections via rustls package /// Support `SSL` connections via rustls package
/// ///