mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
fix guide example
This commit is contained in:
parent
dcc5eb7ace
commit
29a0feb415
@ -337,7 +337,6 @@ from *serde* libary.
|
|||||||
# extern crate futures;
|
# extern crate futures;
|
||||||
#[macro_use] extern crate serde_derive;
|
#[macro_use] extern crate serde_derive;
|
||||||
use actix_web::*;
|
use actix_web::*;
|
||||||
use actix_web::dev::{Path, HttpRequestExtractor};
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct Info {
|
struct Info {
|
||||||
@ -345,7 +344,7 @@ struct Info {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn index(mut req: HttpRequest) -> Result<String> {
|
fn index(mut req: HttpRequest) -> Result<String> {
|
||||||
let info: Info = Path.extract(&req)?; // <- extract path info using serde
|
let info: Info = req.extract_path()?; // <- extract path info using serde
|
||||||
Ok(format!("Welcome {}!", info.username))
|
Ok(format!("Welcome {}!", info.username))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user