1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

update doc string

This commit is contained in:
Nikolay Kim 2018-05-11 15:01:15 -07:00
parent 095ad328ee
commit 487a713ca0

View File

@ -492,14 +492,15 @@ where
/// } /// }
/// ///
/// /// extract path info using serde /// /// extract path info using serde
/// fn index(state: State<MyApp>, info: Path<Info>) -> String { /// fn index(data: (State<MyApp>, Path<Info>)) -> String {
/// format!("{} {}!", state.msg, info.username) /// let (state, path) = data;
/// format!("{} {}!", state.msg, path.username)
/// } /// }
/// ///
/// fn main() { /// fn main() {
/// let app = App::with_state(MyApp{msg: "Welcome"}).resource( /// let app = App::with_state(MyApp{msg: "Welcome"}).resource(
/// "/{username}/index.html", // <- define path parameters /// "/{username}/index.html", // <- define path parameters
/// |r| r.method(http::Method::GET).with2(index)); // <- use `with` extractor /// |r| r.method(http::Method::GET).with(index)); // <- use `with` extractor
/// } /// }
/// ``` /// ```
pub struct State<S>(HttpRequest<S>); pub struct State<S>(HttpRequest<S>);