From 32052c2750f266b1b6ac931ac196c6337d144f12 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 29 Mar 2018 10:01:07 -0700 Subject: [PATCH] update guide --- guide/src/qs_5.md | 14 +++++++------- guide/src/qs_8.md | 2 +- src/extractor.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/guide/src/qs_5.md b/guide/src/qs_5.md index 63cb9cdf..e2c4492e 100644 --- a/guide/src/qs_5.md +++ b/guide/src/qs_5.md @@ -327,8 +327,8 @@ List of `FromParam` implementations can be found in Actix provides functionality for type safe request path information extraction. It uses *serde* package as a deserialization library. -[HttpRequest::extract_path()](../actix_web/struct.HttpRequest.html#method.extract_path) - extracts information, the destination type has to implement *serde's *`Deserialize` trait. +[Path](../actix_web/struct.Path.html) extracts information, the destination type +has to implement *serde's *`Deserialize` trait. ```rust # extern crate bytes; @@ -342,20 +342,20 @@ struct Info { username: String, } -fn index(mut req: HttpRequest) -> Result { - let info: Info = req.extract_path()?; // <- extract path info using serde +// extract path info using serde +fn index(info: Path) -> Result { Ok(format!("Welcome {}!", info.username)) } fn main() { let app = Application::new() .resource("/{username}/index.html", // <- define path parameters - |r| r.method(Method::GET).f(index)); + |r| r.method(Method::GET).with(index)); } ``` -[HttpRequest::extract_query()](../actix_web/struct.HttpRequest.html#method.extract_query) - provides similar functionality for request query parameters. +[Query](../actix_web/struct.Query.html) provides similar functionality for +request query parameters. ## Generating resource URLs diff --git a/guide/src/qs_8.md b/guide/src/qs_8.md index 298c4732..d8c96d81 100644 --- a/guide/src/qs_8.md +++ b/guide/src/qs_8.md @@ -130,7 +130,7 @@ impl Actor for Ws { type Context = ws::WebsocketContext; } -impl StreamHandler for Ws { +impl StreamHandler for Ws { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { diff --git a/src/extractor.rs b/src/extractor.rs index 8d8189f9..1eca75ce 100644 --- a/src/extractor.rs +++ b/src/extractor.rs @@ -91,7 +91,7 @@ impl Path { &self.req } - /// Deconstruct instance into a parts + /// Deconstruct instance into parts pub fn into(self) -> (T, HttpRequest) { (self.item, self.req) } @@ -179,7 +179,7 @@ impl Query { &self.req } - /// Deconstruct instance into a parts + /// Deconstruct instance into parts pub fn into(self) -> (T, HttpRequest) { (self.item, self.req) }