diff --git a/README.md b/README.md index 46f589d6..6f9a41bc 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,14 @@ Actix web is a simple, pragmatic, extremely fast, web framework for Rust. ```rust extern crate actix_web; -use actix_web::{App, HttpServer, Path}; +use actix_web::{server, App, Path}; fn index(info: Path<(String, u32)>) -> String { format!("Hello {}! id:{}", info.0, info.1) } fn main() { - HttpServer::new( + server::new( || App::new() .resource("/{name}/{id}/index.html", |r| r.with(index))) .bind("127.0.0.1:8080").unwrap() diff --git a/src/application.rs b/src/application.rs index 96a932c9..872f413e 100644 --- a/src/application.rs +++ b/src/application.rs @@ -439,7 +439,7 @@ impl App where S: 'static { /// ```rust /// # use std::thread; /// # extern crate actix_web; - /// use actix_web::*; + /// use actix_web::{server, App, HttpResponse}; /// /// struct State1; /// @@ -447,7 +447,7 @@ impl App where S: 'static { /// /// fn main() { /// # thread::spawn(|| { - /// HttpServer::new(|| { vec![ + /// server::new(|| { vec![ /// App::with_state(State1) /// .prefix("/app1") /// .resource("/", |r| r.f(|r| HttpResponse::Ok())) diff --git a/src/lib.rs b/src/lib.rs index f0aef5cc..436c0c0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ //! Actix web is a small, pragmatic, extremely fast, web framework for Rust. //! //! ```rust -//! use actix_web::{App, HttpServer, Path}; +//! use actix_web::{server, App, Path}; //! # use std::thread; //! //! fn index(info: Path<(String, u32)>) -> String { @@ -10,7 +10,7 @@ //! //! fn main() { //! # thread::spawn(|| { -//! HttpServer::new( +//! server::new( //! || App::new() //! .resource("/{name}/{id}/index.html", |r| r.with(index))) //! .bind("127.0.0.1:8080").unwrap() diff --git a/src/server/srv.rs b/src/server/srv.rs index 041021ac..f8915e0d 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -262,12 +262,12 @@ impl HttpServer /// ```rust /// extern crate actix; /// extern crate actix_web; - /// use actix_web::*; + /// use actix_web::{server, App, HttpResponse}; /// /// fn main() { /// let sys = actix::System::new("example"); // <- create Actix system /// - /// HttpServer::new( + /// server::new( /// || App::new() /// .resource("/", |r| r.h(|_| HttpResponse::Ok()))) /// .bind("127.0.0.1:0").expect("Can not bind to 127.0.0.1:0") diff --git a/tests/test_server.rs b/tests/test_server.rs index a13fc2f8..8f3401db 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -63,7 +63,7 @@ fn test_start() { thread::spawn(move || { let sys = System::new("test"); - let srv = HttpServer::new( + let srv = server::new( || vec![App::new() .resource( "/", |r| r.method(http::Method::GET) @@ -108,7 +108,7 @@ fn test_shutdown() { thread::spawn(move || { let sys = System::new("test"); - let srv = HttpServer::new( + let srv = server::new( || vec![App::new() .resource( "/", |r| r.method(http::Method::GET).f(|_| HttpResponse::Ok()))]);