From 170d3163f3195874bce967ff3bfe7ed71c36fbbf Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 26 Nov 2017 22:53:28 -0800 Subject: [PATCH] better export naming --- src/channel.rs | 1 + src/dev.rs | 2 ++ src/lib.rs | 10 +++++----- src/middlewares/mod.rs | 4 ++-- src/prelude.rs | 8 ++++++++ src/ws.rs | 1 - 6 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 src/prelude.rs diff --git a/src/channel.rs b/src/channel.rs index 2d70b93a0..36cd7bdc3 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -26,6 +26,7 @@ enum HttpProtocol H2(h2::Http2), } +#[doc(hidden)] pub struct HttpChannel where T: AsyncRead + AsyncWrite + 'static, H: 'static { diff --git a/src/dev.rs b/src/dev.rs index dd23a6066..296801e68 100644 --- a/src/dev.rs +++ b/src/dev.rs @@ -13,4 +13,6 @@ pub use super::*; // dev specific pub use task::Task; pub use pipeline::Pipeline; +pub use route::RouteFactory; pub use recognizer::RouteRecognizer; +pub use channel::HttpChannel; diff --git a/src/lib.rs b/src/lib.rs index 9543ad21a..039f4ffd1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,27 +71,27 @@ mod h2writer; pub mod ws; pub mod dev; +pub mod prelude; pub mod error; pub mod httpcodes; pub mod multipart; pub mod middlewares; pub use encoding::ContentEncoding; pub use body::{Body, Binary}; -pub use application::{Application, ApplicationBuilder}; +pub use application::Application; pub use httprequest::{HttpRequest, UrlEncoded}; -pub use httpresponse::{HttpResponse, HttpResponseBuilder}; +pub use httpresponse::HttpResponse; pub use payload::{Payload, PayloadItem}; pub use route::{Frame, Route, RouteFactory, RouteHandler, RouteResult}; pub use resource::{Reply, Resource}; -pub use recognizer::{Params, RouteRecognizer}; +pub use recognizer::Params; pub use server::HttpServer; pub use context::HttpContext; -pub use channel::HttpChannel; pub use staticfiles::StaticFiles; // re-exports pub use http::{Method, StatusCode, Version}; -pub use cookie::{Cookie, CookieBuilder}; +pub use cookie::Cookie; pub use http_range::HttpRange; #[cfg(feature="tls")] diff --git a/src/middlewares/mod.rs b/src/middlewares/mod.rs index f9720db5c..abb25800a 100644 --- a/src/middlewares/mod.rs +++ b/src/middlewares/mod.rs @@ -13,10 +13,10 @@ pub use self::session::{RequestSession, Session, SessionImpl, SessionBackend, Se /// Middleware start result pub enum Started { - /// Moddleware error - Err(Error), /// Execution completed Done, + /// Moddleware error + Err(Error), /// New http response got generated. If middleware generates response /// handler execution halts. Response(HttpResponse), diff --git a/src/prelude.rs b/src/prelude.rs new file mode 100644 index 000000000..6f7a777ae --- /dev/null +++ b/src/prelude.rs @@ -0,0 +1,8 @@ +//! The `actix-web` prelude + +pub use super::*; + +pub use error::*; +pub use application::ApplicationBuilder; +pub use httpresponse::HttpResponseBuilder; +pub use cookie::CookieBuilder; diff --git a/src/ws.rs b/src/ws.rs index d78cbf052..6ae76826b 100644 --- a/src/ws.rs +++ b/src/ws.rs @@ -166,7 +166,6 @@ pub fn handshake(req: &HttpRequest) -> Result