From e6feec62a8ac63e6696c8c7b9bc0226d2503966d Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 1 Dec 2017 21:31:38 -0800 Subject: [PATCH] simplier examples --- guide/src/qs_3.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/guide/src/qs_3.md b/guide/src/qs_3.md index 217744b4..0e06371a 100644 --- a/guide/src/qs_3.md +++ b/guide/src/qs_3.md @@ -55,17 +55,9 @@ fn index(req: HttpRequest) -> String { } fn main() { - let sys = actix::System::new("example"); - - HttpServer::new( - Application::build("/", AppState{counter: Cell::new(0)}) - .resource("/", |r| r.handler(Method::GET, index))) - .serve::<_, ()>("127.0.0.1:8088").unwrap(); - - println!("Started http server: 127.0.0.1:8088"); - actix::Arbiter::system().send(actix::msgs::SystemExit(0)); // <- remove this line, this code stops system during testing - - let _ = sys.run(); + Application::build("/", AppState{counter: Cell::new(0)}) + .resource("/", |r| r.handler(Method::GET, index))) + .finish(); } ``` @@ -164,11 +156,6 @@ fn main() { If `specialization` is enabled, conversion could be simplier: ```rust,ignore -#[derive(Serialize)] -struct MyObj { - name: String, -} - impl Into> for MyObj { fn into(self) -> Result { let body = serde_json::to_string(&self)?;