mirror of
https://github.com/fafhrd91/actix-net
synced 2024-12-03 19:42:13 +01:00
update tests
This commit is contained in:
parent
8fe7ce533c
commit
e8aa73a44b
@ -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 {
|
||||||
|
@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
@ -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 {
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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))
|
||||||
|
@ -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>>);
|
||||||
|
@ -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
|
||||||
///
|
///
|
||||||
|
@ -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
|
||||||
///
|
///
|
||||||
|
@ -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
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user