mirror of
https://github.com/actix/actix-web.git
synced 2024-11-29 21:11:17 +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
|
||||
/// fn index(state: State<MyApp>, info: Path<Info>) -> String {
|
||||
/// format!("{} {}!", state.msg, info.username)
|
||||
/// fn index(data: (State<MyApp>, Path<Info>)) -> String {
|
||||
/// let (state, path) = data;
|
||||
/// format!("{} {}!", state.msg, path.username)
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
/// let app = App::with_state(MyApp{msg: "Welcome"}).resource(
|
||||
/// "/{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>);
|
||||
|
|
Loading…
Reference in a new issue