mirror of
https://github.com/actix/actix-web.git
synced 2024-11-26 19:41:12 +00:00
update doc string
This commit is contained in:
parent
095ad328ee
commit
487a713ca0
1 changed files with 4 additions and 3 deletions
|
@ -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>);
|
||||||
|
|
Loading…
Reference in a new issue