1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

Re-export actix dependency. Closes #260 (#264)

- Re-export actix's prelude into actix namespace
- Removing implicit dependency on root's actix module
This commit is contained in:
Douman 2018-05-31 20:43:14 +03:00 committed by GitHub
parent 77becb9bc0
commit 80965d7a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 50 additions and 34 deletions

View File

@ -1,12 +1,14 @@
extern crate actix;
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
use std::net::Shutdown; use std::net::Shutdown;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use std::{fmt, io, mem, time}; use std::{fmt, io, mem, time};
use actix::actors::{Connect as ResolveConnect, Connector, ConnectorError}; use self::actix::actors::{Connect as ResolveConnect, Connector, ConnectorError};
use actix::fut::WrapFuture; use self::actix::fut::WrapFuture;
use actix::registry::SystemService; use self::actix::registry::SystemService;
use actix::{ use self::actix::{
fut, Actor, ActorFuture, ActorResponse, AsyncContext, Context, ContextFutureSpawner, fut, Actor, ActorFuture, ActorResponse, AsyncContext, Context, ContextFutureSpawner,
Handler, Message, Recipient, StreamHandler, Supervised, Handler, Message, Recipient, StreamHandler, Supervised,
}; };

View File

@ -1,7 +1,6 @@
//! Http client api //! Http client api
//! //!
//! ```rust //! ```rust
//! # extern crate actix;
//! # extern crate actix_web; //! # extern crate actix_web;
//! # extern crate futures; //! # extern crate futures;
//! # extern crate tokio; //! # extern crate tokio;
@ -63,7 +62,6 @@ impl ResponseError for SendRequestError {
/// ///
/// ///
/// ```rust /// ```rust
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// # extern crate futures; /// # extern crate futures;
/// # extern crate tokio; /// # extern crate tokio;

View File

@ -1,3 +1,5 @@
extern crate actix;
use bytes::{Bytes, BytesMut}; use bytes::{Bytes, BytesMut};
use futures::sync::oneshot; use futures::sync::oneshot;
use futures::{Async, Future, Poll}; use futures::{Async, Future, Poll};
@ -6,7 +8,7 @@ use std::time::{Duration, Instant};
use std::{io, mem}; use std::{io, mem};
use tokio_timer::Delay; use tokio_timer::Delay;
use actix::prelude::*; use self::actix::prelude::*;
use super::{ use super::{
ClientBody, ClientBodyStream, ClientConnector, ClientConnectorError, ClientRequest, ClientBody, ClientBodyStream, ClientConnector, ClientConnectorError, ClientRequest,

View File

@ -25,7 +25,6 @@ use httprequest::HttpRequest;
/// An HTTP Client Request /// An HTTP Client Request
/// ///
/// ```rust /// ```rust
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// # extern crate futures; /// # extern crate futures;
/// # extern crate tokio; /// # extern crate tokio;

View File

@ -1,12 +1,14 @@
extern crate actix;
use futures::sync::oneshot; use futures::sync::oneshot;
use futures::sync::oneshot::Sender; use futures::sync::oneshot::Sender;
use futures::{Async, Future, Poll}; use futures::{Async, Future, Poll};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::marker::PhantomData; use std::marker::PhantomData;
use actix::dev::{ContextImpl, Envelope, ToEnvelope}; use self::actix::dev::{ContextImpl, Envelope, ToEnvelope};
use actix::fut::ActorFuture; use self::actix::fut::ActorFuture;
use actix::{ use self::actix::{
Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle, Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle,
}; };

View File

@ -229,8 +229,8 @@ pub trait HttpMessage {
/// # extern crate env_logger; /// # extern crate env_logger;
/// # extern crate futures; /// # extern crate futures;
/// # use std::str; /// # use std::str;
/// # use actix::*;
/// # use actix_web::*; /// # use actix_web::*;
/// # use actix::*;
/// # use futures::{Future, Stream}; /// # use futures::{Future, Stream};
/// # use futures::future::{ok, result, Either}; /// # use futures::future::{ok, result, Either};
/// fn index(mut req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> { /// fn index(mut req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {

View File

@ -132,7 +132,7 @@ extern crate serde_json;
extern crate serde_urlencoded; extern crate serde_urlencoded;
extern crate smallvec; extern crate smallvec;
#[macro_use] #[macro_use]
extern crate actix; pub extern crate actix as actix_inner;
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]
@ -195,6 +195,12 @@ pub use httpresponse::HttpResponse;
pub use json::Json; pub use json::Json;
pub use scope::Scope; pub use scope::Scope;
pub mod actix {
//! Re-exports [actix's](https://docs.rs/actix) prelude
pub use actix_inner::prelude::*;
}
#[doc(hidden)] #[doc(hidden)]
#[deprecated(since = "0.6.2", note = "please use `use actix_web::ws::WsWriter`")] #[deprecated(since = "0.6.2", note = "please use `use actix_web::ws::WsWriter`")]
pub use ws::WsWriter; pub use ws::WsWriter;

View File

@ -143,7 +143,6 @@ pub trait IdentityPolicy<S>: Sized + 'static {
/// Request identity middleware /// Request identity middleware
/// ///
/// ```rust /// ```rust
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// use actix_web::App; /// use actix_web::App;
/// use actix_web::middleware::identity::{IdentityService, CookieIdentityPolicy}; /// use actix_web::middleware::identity::{IdentityService, CookieIdentityPolicy};

View File

@ -229,7 +229,6 @@ unsafe impl Sync for SessionImplCell {}
/// Session storage middleware /// Session storage middleware
/// ///
/// ```rust /// ```rust
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// use actix_web::App; /// use actix_web::App;
/// use actix_web::middleware::session::{SessionStorage, CookieSessionBackend}; /// use actix_web::middleware::session::{SessionStorage, CookieSessionBackend};

View File

@ -1,8 +1,9 @@
//! Http server //! Http server
extern crate actix;
use std::net::Shutdown; use std::net::Shutdown;
use std::{io, time}; use std::{io, time};
use actix;
use bytes::BytesMut; use bytes::BytesMut;
use futures::{Async, Poll}; use futures::{Async, Poll};
use tokio_io::{AsyncRead, AsyncWrite}; 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. /// This is shortcut for `server::HttpServer::new()` method.
/// ///
/// ```rust /// ```rust
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// use actix::*; /// use actix_web::actix::*;
/// use actix_web::{server, App, HttpResponse}; /// use actix_web::{server, App, HttpResponse};
/// ///
/// fn main() { /// fn main() {

View File

@ -1,10 +1,12 @@
extern crate actix;
use std::rc::Rc; use std::rc::Rc;
use std::sync::{mpsc as sync_mpsc, Arc}; use std::sync::{mpsc as sync_mpsc, Arc};
use std::time::Duration; use std::time::Duration;
use std::{io, net, thread}; use std::{io, net, thread};
use actix::actors::signal; use self::actix::actors::signal;
use actix::prelude::*; use self::actix::prelude::*;
use futures::sync::mpsc; use futures::sync::mpsc;
use futures::{Future, Sink, Stream}; use futures::{Future, Sink, Stream};
use mio; use mio;
@ -19,7 +21,7 @@ use native_tls::TlsAcceptor;
#[cfg(feature = "alpn")] #[cfg(feature = "alpn")]
use openssl::ssl::{AlpnError, SslAcceptorBuilder}; use openssl::ssl::{AlpnError, SslAcceptorBuilder};
use super::channel::{HttpChannel, WrapperStream}; use super::channel::{WrapperStream};
use super::settings::{ServerSettings, WorkerSettings}; use super::settings::{ServerSettings, WorkerSettings};
use super::worker::{Conn, SocketInfo, StopWorker, StreamHandlerType, Worker}; use super::worker::{Conn, SocketInfo, StopWorker, StreamHandlerType, Worker};
use super::{IntoHttpHandler, IoStream, KeepAlive}; use super::{IntoHttpHandler, IoStream, KeepAlive};
@ -405,8 +407,8 @@ impl<H: IntoHttpHandler> HttpServer<H> {
/// This method requires to run within properly configured `Actix` system. /// This method requires to run within properly configured `Actix` system.
/// ///
/// ```rust /// ```rust
/// extern crate actix;
/// extern crate actix_web; /// extern crate actix_web;
/// extern crate actix;
/// use actix_web::{server, App, HttpResponse}; /// use actix_web::{server, App, HttpResponse};
/// ///
/// fn main() { /// fn main() {
@ -478,7 +480,6 @@ impl<H: IntoHttpHandler> HttpServer<H> {
/// ///
/// ```rust,ignore /// ```rust,ignore
/// # extern crate futures; /// # extern crate futures;
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// # use futures::Future; /// # use futures::Future;
/// use actix_web::*; /// use actix_web::*;

View File

@ -1,3 +1,5 @@
extern crate actix;
use futures::sync::oneshot; use futures::sync::oneshot;
use futures::Future; use futures::Future;
use net2::TcpStreamExt; use net2::TcpStreamExt;
@ -21,8 +23,8 @@ use openssl::ssl::SslAcceptor;
#[cfg(feature = "alpn")] #[cfg(feature = "alpn")]
use tokio_openssl::SslAcceptorExt; use tokio_openssl::SslAcceptorExt;
use actix::msgs::StopArbiter; use self::actix::msgs::StopArbiter;
use actix::*; use self::actix::*;
use server::channel::HttpChannel; use server::channel::HttpChannel;
use server::settings::WorkerSettings; use server::settings::WorkerSettings;

View File

@ -1,11 +1,13 @@
//! Various helpers for Actix applications to use during testing. //! Various helpers for Actix applications to use during testing.
extern crate actix;
use std::rc::Rc; use std::rc::Rc;
use std::str::FromStr; use std::str::FromStr;
use std::sync::mpsc; use std::sync::mpsc;
use std::{net, thread}; use std::{net, thread};
use actix::{msgs, Actor, Addr, Arbiter, System}; use self::actix::{msgs, Actor, Addr, Arbiter, System};
use cookie::Cookie; use cookie::Cookie;
use futures::Future; use futures::Future;
use http::header::HeaderName; use http::header::HeaderName;
@ -40,7 +42,6 @@ use ws;
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// # extern crate actix;
/// # extern crate actix_web; /// # extern crate actix_web;
/// # use actix_web::*; /// # use actix_web::*;
/// # /// #

View File

@ -1,4 +1,6 @@
//! Http client request //! Http client request
extern crate actix;
use std::cell::UnsafeCell; use std::cell::UnsafeCell;
use std::rc::Rc; use std::rc::Rc;
use std::time::Duration; use std::time::Duration;
@ -14,7 +16,7 @@ use http::{Error as HttpError, HttpTryFrom, StatusCode};
use rand; use rand;
use sha1::Sha1; use sha1::Sha1;
use actix::prelude::*; use self::actix::prelude::*;
use body::Binary; use body::Binary;
use error::{Error, UrlParseError}; use error::{Error, UrlParseError};

View File

@ -1,10 +1,12 @@
extern crate actix;
use futures::sync::oneshot::{self, Sender}; use futures::sync::oneshot::{self, Sender};
use futures::{Async, Poll}; use futures::{Async, Poll};
use smallvec::SmallVec; use smallvec::SmallVec;
use actix::dev::{ContextImpl, Envelope, ToEnvelope}; use self::actix::dev::{ContextImpl, Envelope, ToEnvelope};
use actix::fut::ActorFuture; use self::actix::fut::ActorFuture;
use actix::{ use self::actix::{
Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle, Actor, ActorContext, ActorState, Addr, AsyncContext, Handler, Message, SpawnHandle,
}; };

View File

@ -7,9 +7,8 @@
//! ## Example //! ## Example
//! //!
//! ```rust //! ```rust
//! # extern crate actix;
//! # extern crate actix_web; //! # extern crate actix_web;
//! # use actix::*; //! # use actix_web::actix::*;
//! # use actix_web::*; //! # use actix_web::*;
//! use actix_web::{ws, HttpRequest, HttpResponse}; //! use actix_web::{ws, HttpRequest, HttpResponse};
//! //!
@ -43,11 +42,13 @@
//! # .finish(); //! # .finish();
//! # } //! # }
//! ``` //! ```
extern crate actix;
use bytes::Bytes; use bytes::Bytes;
use futures::{Async, Poll, Stream}; use futures::{Async, Poll, Stream};
use http::{header, Method, StatusCode}; use http::{header, Method, StatusCode};
use actix::{Actor, AsyncContext, StreamHandler}; use self::actix::{Actor, AsyncContext, StreamHandler};
use body::Binary; use body::Binary;
use error::{Error, PayloadError, ResponseError}; use error::{Error, PayloadError, ResponseError};