From cce9c68a10b4fd0d0312cce7d623e71a8350974f Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 26 Dec 2017 12:46:27 -0800 Subject: [PATCH] add doc string --- src/server.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/server.rs b/src/server.rs index fcdad1e6f..d1ce80a6a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -264,6 +264,27 @@ impl HttpServer /// For each address this method starts separate thread which does `accept()` in a loop. /// /// This methods panics if no socket addresses get bound. + /// + /// This method requires to run within properly configured `Actix` system. + /// + /// ```rust + /// extern crate actix; + /// extern crate actix_web; + /// use actix_web::*; + /// + /// fn main() { + /// let sys = actix::System::new("example"); // <- create Actix system + /// + /// HttpServer::new( + /// || Application::new() + /// .resource("/", |r| r.h(httpcodes::HTTPOk))) + /// .bind("127.0.0.1:8088").expect("Can not bind to 127.0.0.1:8088") + /// .start(); + /// # actix::Arbiter::system().send(actix::msgs::SystemExit(0)); + /// + /// let _ = sys.run(); // <- Run actix system, this method actually starts all async processes + /// } + /// ``` pub fn start(mut self) -> SyncAddress { if self.sockets.is_empty() {