From 36161aba99231e8dbdae70cdcddba277d9461167 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 28 Mar 2018 07:27:06 -0700 Subject: [PATCH] update Path and Query doc strings --- src/extractor.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/extractor.rs b/src/extractor.rs index 0736b00d..8700ee3b 100644 --- a/src/extractor.rs +++ b/src/extractor.rs @@ -29,18 +29,21 @@ pub trait HttpRequestExtractor: Sized where T: DeserializeOwned, S: 'stati /// use actix_web::*; /// use actix_web::Path; /// +/// /// Application state +/// struct State {} +/// /// #[derive(Deserialize)] /// struct Info { /// username: String, /// } /// /// /// extract path info using serde -/// fn index(info: Path) -> Result { +/// fn index(info: Path) -> Result { /// Ok(format!("Welcome {}!", info.username)) /// } /// /// fn main() { -/// let app = Application::new().resource( +/// let app = Application::with_state(State{}).resource( /// "/{username}/index.html", // <- define path parameters /// |r| r.method(Method::GET).with(index)); // <- use `with` extractor /// } @@ -113,6 +116,9 @@ impl HttpRequestExtractor for Path /// use actix_web::*; /// use actix_web::Query; /// +/// /// Application state +/// struct State {} +/// /// #[derive(Deserialize)] /// struct Info { /// username: String, @@ -120,12 +126,12 @@ impl HttpRequestExtractor for Path /// /// // use `with` extractor for query info /// // this handler get called only if request's query contains `username` field -/// fn index(info: Query) -> Result { +/// fn index(info: Query) -> Result { /// Ok(format!("Welcome {}!", info.username)) /// } /// /// fn main() { -/// let app = Application::new().resource( +/// let app = Application::with_state(State{}).resource( /// "/index.html", /// |r| r.method(Method::GET).with(index)); // <- use `with` extractor /// }