diff --git a/src/client/connector.rs b/src/client/connector.rs index 65d4ded0d..82d932e47 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -1,12 +1,14 @@ +extern crate actix; + use std::collections::{HashMap, VecDeque}; use std::net::Shutdown; use std::time::{Duration, Instant}; use std::{fmt, io, mem, time}; -use actix::actors::{Connect as ResolveConnect, Connector, ConnectorError}; -use actix::fut::WrapFuture; -use actix::registry::SystemService; -use actix::{ +use self::actix::actors::{Connect as ResolveConnect, Connector, ConnectorError}; +use self::actix::fut::WrapFuture; +use self::actix::registry::SystemService; +use self::actix::{ fut, Actor, ActorFuture, ActorResponse, AsyncContext, Context, ContextFutureSpawner, Handler, Message, Recipient, StreamHandler, Supervised, }; diff --git a/src/client/mod.rs b/src/client/mod.rs index 8aded0114..0e7befc3c 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1,7 +1,6 @@ //! Http client api //! //! ```rust -//! # extern crate actix; //! # extern crate actix_web; //! # extern crate futures; //! # extern crate tokio; @@ -63,7 +62,6 @@ impl ResponseError for SendRequestError { /// /// /// ```rust -/// # extern crate actix; /// # extern crate actix_web; /// # extern crate futures; /// # extern crate tokio; diff --git a/src/client/pipeline.rs b/src/client/pipeline.rs index a2105ecb7..84593677d 100644 --- a/src/client/pipeline.rs +++ b/src/client/pipeline.rs @@ -1,3 +1,5 @@ +extern crate actix; + use bytes::{Bytes, BytesMut}; use futures::sync::oneshot; use futures::{Async, Future, Poll}; @@ -6,7 +8,7 @@ use std::time::{Duration, Instant}; use std::{io, mem}; use tokio_timer::Delay; -use actix::prelude::*; +use self::actix::prelude::*; use super::{ ClientBody, ClientBodyStream, ClientConnector, ClientConnectorError, ClientRequest, diff --git a/src/client/request.rs b/src/client/request.rs index 97b97e01b..eebf8e007 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -25,7 +25,6 @@ use httprequest::HttpRequest; /// An HTTP Client Request /// /// ```rust -/// # extern crate actix; /// # extern crate actix_web; /// # extern crate futures; /// # extern crate tokio; diff --git a/src/context.rs b/src/context.rs index b40b4bbbc..3f8cf5ee3 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,12 +1,14 @@ +extern crate actix; + use futures::sync::oneshot; use futures::sync::oneshot::Sender; use futures::{Async, Future, Poll}; use smallvec::SmallVec; use std::marker::PhantomData; -use actix::dev::{ContextImpl, Envelope, ToEnvelope}; -use actix::fut::ActorFuture; -use actix::{ +use self::actix::dev::{ContextImpl, Envelope, ToEnvelope}; +use self::actix::fut::ActorFuture; +use self::actix::{ Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle, }; diff --git a/src/httpmessage.rs b/src/httpmessage.rs index 2f23e6536..2f0a9c99b 100644 --- a/src/httpmessage.rs +++ b/src/httpmessage.rs @@ -229,8 +229,8 @@ pub trait HttpMessage { /// # extern crate env_logger; /// # extern crate futures; /// # use std::str; - /// # use actix::*; /// # use actix_web::*; + /// # use actix::*; /// # use futures::{Future, Stream}; /// # use futures::future::{ok, result, Either}; /// fn index(mut req: HttpRequest) -> Box> { diff --git a/src/lib.rs b/src/lib.rs index a428b08bc..8d728f998 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -132,7 +132,7 @@ extern crate serde_json; extern crate serde_urlencoded; extern crate smallvec; #[macro_use] -extern crate actix; +pub extern crate actix as actix_inner; #[cfg(test)] #[macro_use] @@ -195,6 +195,12 @@ pub use httpresponse::HttpResponse; pub use json::Json; pub use scope::Scope; +pub mod actix { + //! Re-exports [actix's](https://docs.rs/actix) prelude + + pub use actix_inner::prelude::*; +} + #[doc(hidden)] #[deprecated(since = "0.6.2", note = "please use `use actix_web::ws::WsWriter`")] pub use ws::WsWriter; diff --git a/src/middleware/identity.rs b/src/middleware/identity.rs index 36317ebcf..54d97a1c8 100644 --- a/src/middleware/identity.rs +++ b/src/middleware/identity.rs @@ -143,7 +143,6 @@ pub trait IdentityPolicy: Sized + 'static { /// Request identity middleware /// /// ```rust -/// # extern crate actix; /// # extern crate actix_web; /// use actix_web::App; /// use actix_web::middleware::identity::{IdentityService, CookieIdentityPolicy}; diff --git a/src/middleware/session.rs b/src/middleware/session.rs index 57f42a117..f80d1f11e 100644 --- a/src/middleware/session.rs +++ b/src/middleware/session.rs @@ -229,7 +229,6 @@ unsafe impl Sync for SessionImplCell {} /// Session storage middleware /// /// ```rust -/// # extern crate actix; /// # extern crate actix_web; /// use actix_web::App; /// use actix_web::middleware::session::{SessionStorage, CookieSessionBackend}; diff --git a/src/server/mod.rs b/src/server/mod.rs index 268764830..32138f30b 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -1,8 +1,9 @@ //! Http server +extern crate actix; + use std::net::Shutdown; use std::{io, time}; -use actix; use bytes::BytesMut; use futures::{Async, Poll}; use tokio_io::{AsyncRead, AsyncWrite}; @@ -42,9 +43,8 @@ pub(crate) const MAX_WRITE_BUFFER_SIZE: usize = 65_536; /// This is shortcut for `server::HttpServer::new()` method. /// /// ```rust -/// # extern crate actix; /// # extern crate actix_web; -/// use actix::*; +/// use actix_web::actix::*; /// use actix_web::{server, App, HttpResponse}; /// /// fn main() { diff --git a/src/server/srv.rs b/src/server/srv.rs index df6a4b9d4..5ea28d6c5 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -1,10 +1,12 @@ +extern crate actix; + use std::rc::Rc; use std::sync::{mpsc as sync_mpsc, Arc}; use std::time::Duration; use std::{io, net, thread}; -use actix::actors::signal; -use actix::prelude::*; +use self::actix::actors::signal; +use self::actix::prelude::*; use futures::sync::mpsc; use futures::{Future, Sink, Stream}; use mio; @@ -19,7 +21,7 @@ use native_tls::TlsAcceptor; #[cfg(feature = "alpn")] use openssl::ssl::{AlpnError, SslAcceptorBuilder}; -use super::channel::{HttpChannel, WrapperStream}; +use super::channel::{WrapperStream}; use super::settings::{ServerSettings, WorkerSettings}; use super::worker::{Conn, SocketInfo, StopWorker, StreamHandlerType, Worker}; use super::{IntoHttpHandler, IoStream, KeepAlive}; @@ -405,8 +407,8 @@ impl HttpServer { /// This method requires to run within properly configured `Actix` system. /// /// ```rust - /// extern crate actix; /// extern crate actix_web; + /// extern crate actix; /// use actix_web::{server, App, HttpResponse}; /// /// fn main() { @@ -478,7 +480,6 @@ impl HttpServer { /// /// ```rust,ignore /// # extern crate futures; - /// # extern crate actix; /// # extern crate actix_web; /// # use futures::Future; /// use actix_web::*; diff --git a/src/server/worker.rs b/src/server/worker.rs index d9cca29f6..636f859a4 100644 --- a/src/server/worker.rs +++ b/src/server/worker.rs @@ -1,3 +1,5 @@ +extern crate actix; + use futures::sync::oneshot; use futures::Future; use net2::TcpStreamExt; @@ -21,8 +23,8 @@ use openssl::ssl::SslAcceptor; #[cfg(feature = "alpn")] use tokio_openssl::SslAcceptorExt; -use actix::msgs::StopArbiter; -use actix::*; +use self::actix::msgs::StopArbiter; +use self::actix::*; use server::channel::HttpChannel; use server::settings::WorkerSettings; diff --git a/src/test.rs b/src/test.rs index 558695ad7..b022e35ed 100644 --- a/src/test.rs +++ b/src/test.rs @@ -1,11 +1,13 @@ //! Various helpers for Actix applications to use during testing. +extern crate actix; + use std::rc::Rc; use std::str::FromStr; use std::sync::mpsc; use std::{net, thread}; -use actix::{msgs, Actor, Addr, Arbiter, System}; +use self::actix::{msgs, Actor, Addr, Arbiter, System}; use cookie::Cookie; use futures::Future; use http::header::HeaderName; @@ -40,7 +42,6 @@ use ws; /// # Examples /// /// ```rust -/// # extern crate actix; /// # extern crate actix_web; /// # use actix_web::*; /// # diff --git a/src/ws/client.rs b/src/ws/client.rs index fcf6ed40a..ac77a28fb 100644 --- a/src/ws/client.rs +++ b/src/ws/client.rs @@ -1,4 +1,6 @@ //! Http client request +extern crate actix; + use std::cell::UnsafeCell; use std::rc::Rc; use std::time::Duration; @@ -14,7 +16,7 @@ use http::{Error as HttpError, HttpTryFrom, StatusCode}; use rand; use sha1::Sha1; -use actix::prelude::*; +use self::actix::prelude::*; use body::Binary; use error::{Error, UrlParseError}; diff --git a/src/ws/context.rs b/src/ws/context.rs index 2d7802b0a..48f37f225 100644 --- a/src/ws/context.rs +++ b/src/ws/context.rs @@ -1,10 +1,12 @@ +extern crate actix; + use futures::sync::oneshot::{self, Sender}; use futures::{Async, Poll}; use smallvec::SmallVec; -use actix::dev::{ContextImpl, Envelope, ToEnvelope}; -use actix::fut::ActorFuture; -use actix::{ +use self::actix::dev::{ContextImpl, Envelope, ToEnvelope}; +use self::actix::fut::ActorFuture; +use self::actix::{ Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle, }; diff --git a/src/ws/mod.rs b/src/ws/mod.rs index 7f72dea1d..61ec7df91 100644 --- a/src/ws/mod.rs +++ b/src/ws/mod.rs @@ -7,9 +7,8 @@ //! ## Example //! //! ```rust -//! # extern crate actix; //! # extern crate actix_web; -//! # use actix::*; +//! # use actix_web::actix::*; //! # use actix_web::*; //! use actix_web::{ws, HttpRequest, HttpResponse}; //! @@ -43,11 +42,13 @@ //! # .finish(); //! # } //! ``` +extern crate actix; + use bytes::Bytes; use futures::{Async, Poll, Stream}; use http::{header, Method, StatusCode}; -use actix::{Actor, AsyncContext, StreamHandler}; +use self::actix::{Actor, AsyncContext, StreamHandler}; use body::Binary; use error::{Error, PayloadError, ResponseError};