diff --git a/Cargo.toml b/Cargo.toml index 90f7865ba..0981dafca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,8 +47,7 @@ cell = [] [dependencies] actix = "0.7.6" -# actix-service = "0.1" -actix-service = { path="./actix-service" } +actix-service = "0.1.1" log = "0.4" num_cpus = "1.0" @@ -66,7 +65,6 @@ tokio-tcp = "0.1" tokio-timer = "0.2" tokio-reactor = "0.1" tokio-current-thread = "0.1" -tower-service = { git = "https://github.com/tower-rs/tower.git" } trust-dns-proto = "^0.5.0" trust-dns-resolver = "^0.10.0" diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index d9900c4df..332d044a2 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-service" -version = "0.1.0" +version = "0.1.1" authors = ["Nikolay Kim "] description = "Actix Service" keywords = ["network", "framework", "async", "futures"] diff --git a/src/cloneable.rs b/src/cloneable.rs index e367043ac..cbce3e29e 100644 --- a/src/cloneable.rs +++ b/src/cloneable.rs @@ -1,10 +1,10 @@ use std::marker::PhantomData; use std::rc::Rc; +use actix_service::Service; use futures::Poll; use super::cell::Cell; -use super::service::Service; /// Service that allows to turn non-clone service to a service with `Clone` impl pub struct CloneableService { diff --git a/src/connector.rs b/src/connector.rs index e1ede0e7b..cebff826d 100644 --- a/src/connector.rs +++ b/src/connector.rs @@ -4,15 +4,14 @@ use std::net::{IpAddr, SocketAddr}; use std::time::Duration; use std::{fmt, io}; +use actix_service::{NewService, Service}; use futures::future::{ok, Either, FutureResult}; use futures::{try_ready, Async, Future, Poll}; - use tokio_tcp::{ConnectFuture, TcpStream}; use trust_dns_resolver::config::{ResolverConfig, ResolverOpts}; use trust_dns_resolver::system_conf::read_system_conf; use super::resolver::{RequestHost, ResolveError, Resolver, ResolverFuture}; -use super::service::{NewService, Service}; /// Port of the request pub trait RequestPort { diff --git a/src/either.rs b/src/either.rs index d1baab0c8..e5a23e49b 100644 --- a/src/either.rs +++ b/src/either.rs @@ -1,8 +1,7 @@ //! Contains `Either` service and related types and functions. +use actix_service::{NewService, Service}; use futures::{future, try_ready, Async, Future, Poll}; -use super::service::{NewService, Service}; - /// Combine two different service types into a single type. /// /// Both services must be of the same request, response, and error types. diff --git a/src/framed.rs b/src/framed.rs index b66a5dc02..e65489209 100644 --- a/src/framed.rs +++ b/src/framed.rs @@ -3,6 +3,7 @@ use std::marker::PhantomData; use std::mem; use actix; +use actix_service::{IntoNewService, IntoService, NewService, Service}; use futures::future::{ok, FutureResult}; use futures::unsync::mpsc; use futures::{Async, AsyncSink, Future, Poll, Sink, Stream}; @@ -10,7 +11,6 @@ use tokio_codec::{Decoder, Encoder}; use tokio_io::{AsyncRead, AsyncWrite}; use crate::codec::Framed; -use crate::service::{IntoNewService, IntoService, NewService, Service}; type Request = ::Item; type Response = ::Item; diff --git a/src/inflight.rs b/src/inflight.rs index 9e1b35f2a..d4751d055 100644 --- a/src/inflight.rs +++ b/src/inflight.rs @@ -1,7 +1,7 @@ +use actix_service::{IntoNewService, IntoService, NewService, Service}; use futures::{try_ready, Async, Future, Poll}; use super::counter::{Counter, CounterGuard}; -use super::service::{IntoNewService, IntoService, NewService, Service}; /// InFlight - new service for service that can limit number of in-flight /// async requests. diff --git a/src/keepalive.rs b/src/keepalive.rs index d3e31f330..4590c70ec 100644 --- a/src/keepalive.rs +++ b/src/keepalive.rs @@ -1,11 +1,11 @@ use std::marker::PhantomData; use std::time::{Duration, Instant}; +use actix_service::{NewService, Service}; use futures::future::{ok, FutureResult}; use futures::{Async, Future, Poll}; use tokio_timer::Delay; -use super::service::{NewService, Service}; use super::time::{LowResTime, LowResTimeService}; use super::Never; diff --git a/src/resolver.rs b/src/resolver.rs index 0c87c78fe..9c67a2c18 100644 --- a/src/resolver.rs +++ b/src/resolver.rs @@ -4,6 +4,7 @@ use std::net::IpAddr; use futures::{Async, Future, Poll}; +use actix_service::Service; use tokio_current_thread::spawn; use trust_dns_resolver::config::{ResolverConfig, ResolverOpts}; pub use trust_dns_resolver::error::ResolveError; @@ -11,8 +12,6 @@ use trust_dns_resolver::lookup_ip::LookupIpFuture; use trust_dns_resolver::system_conf::read_system_conf; use trust_dns_resolver::{AsyncResolver, Background}; -use super::service::Service; - /// Host name of the request pub trait RequestHost { fn host(&self) -> &str; diff --git a/src/server/config.rs b/src/server/config.rs index b48f89ea3..4409bcf7e 100644 --- a/src/server/config.rs +++ b/src/server/config.rs @@ -1,12 +1,12 @@ use std::collections::HashMap; use std::{fmt, io, net}; +use actix_service::{IntoNewService, NewService}; use futures::future::{join_all, Future}; use log::error; use tokio_tcp::TcpStream; use crate::counter::CounterGuard; -use crate::service::{IntoNewService, NewService}; use super::server::bind_addr; use super::services::{ diff --git a/src/server/services.rs b/src/server/services.rs index 24bde6c7c..562914a07 100644 --- a/src/server/services.rs +++ b/src/server/services.rs @@ -1,6 +1,7 @@ use std::net; use std::time::Duration; +use actix_service::{NewService, Service}; use futures::future::{err, ok, FutureResult}; use futures::{Future, Poll}; use log::error; @@ -10,7 +11,6 @@ use tokio_tcp::TcpStream; use super::Token; use crate::counter::CounterGuard; -use crate::service::{NewService, Service}; /// Server message pub enum ServerMessage { diff --git a/src/ssl/nativetls.rs b/src/ssl/nativetls.rs index 03a661f1b..a2c8c95df 100644 --- a/src/ssl/nativetls.rs +++ b/src/ssl/nativetls.rs @@ -1,13 +1,13 @@ use std::io; use std::marker::PhantomData; +use actix_service::{NewService, Service}; use futures::{future::ok, future::FutureResult, Async, Future, Poll}; use native_tls::{self, Error, HandshakeError, TlsAcceptor}; use tokio_io::{AsyncRead, AsyncWrite}; use super::MAX_CONN_COUNTER; use crate::counter::{Counter, CounterGuard}; -use crate::service::{NewService, Service}; /// Support `SSL` connections via native-tls package /// diff --git a/src/ssl/openssl.rs b/src/ssl/openssl.rs index 0cf148202..aea3f1292 100644 --- a/src/ssl/openssl.rs +++ b/src/ssl/openssl.rs @@ -1,5 +1,6 @@ use std::marker::PhantomData; +use actix_service::{NewService, Service}; use futures::{future::ok, future::FutureResult, Async, Future, Poll}; use openssl::ssl::{Error, SslAcceptor, SslConnector}; use tokio_io::{AsyncRead, AsyncWrite}; @@ -8,7 +9,6 @@ use tokio_openssl::{AcceptAsync, ConnectAsync, SslAcceptorExt, SslConnectorExt, use super::MAX_CONN_COUNTER; use crate::counter::{Counter, CounterGuard}; use crate::resolver::RequestHost; -use crate::service::{NewService, Service}; /// Support `SSL` connections via openssl package /// diff --git a/src/ssl/rustls.rs b/src/ssl/rustls.rs index b3140bcfe..325e5dde4 100644 --- a/src/ssl/rustls.rs +++ b/src/ssl/rustls.rs @@ -2,6 +2,7 @@ use std::io; use std::marker::PhantomData; use std::sync::Arc; +use actix_service::{NewService, Service}; use futures::{future::ok, future::FutureResult, Async, Future, Poll}; use rustls::{ServerConfig, ServerSession}; use tokio_io::{AsyncRead, AsyncWrite}; @@ -9,7 +10,6 @@ use tokio_rustls::{Accept, TlsAcceptor, TlsStream}; use super::MAX_CONN_COUNTER; use crate::counter::{Counter, CounterGuard}; -use crate::service::{NewService, Service}; /// Support `SSL` connections via rustls package /// diff --git a/src/stream.rs b/src/stream.rs index c80678077..618575a6c 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -1,11 +1,10 @@ use std::marker::PhantomData; +use actix_service::{IntoService, NewService, Service}; use futures::unsync::mpsc; use futures::{future, Async, Future, Poll, Stream}; use tokio_current_thread::spawn; -use super::service::{IntoService, NewService, Service}; - pub struct StreamDispatcher { stream: S, service: T, diff --git a/src/time.rs b/src/time.rs index 94f5f6265..27e1d3a83 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,12 +1,12 @@ use std::time::{Duration, Instant}; +use actix_service::{NewService, Service}; use futures::future::{ok, FutureResult}; use futures::{Async, Future, Poll}; use tokio_current_thread::spawn; use tokio_timer::sleep; use super::cell::Cell; -use super::service::{NewService, Service}; use super::Never; #[derive(Clone, Debug)] diff --git a/src/timeout.rs b/src/timeout.rs index be5968ad7..8a18b1ace 100644 --- a/src/timeout.rs +++ b/src/timeout.rs @@ -5,12 +5,11 @@ use std::fmt; use std::time::Duration; +use actix_service::{NewService, Service}; use futures::try_ready; use futures::{Async, Future, Poll}; use tokio_timer::{clock, Delay}; -use crate::service::{NewService, Service}; - /// Applies a timeout to requests. #[derive(Debug)] pub struct Timeout {