From d39affbd1a88f2c7e093c157fbe1e5952510f9e6 Mon Sep 17 00:00:00 2001 From: wuaoxiang Date: Mon, 12 Oct 2020 16:03:43 +0800 Subject: [PATCH] Fix fmt panic at statement (rust-lang/rust#77774) --- examples/actix_web_path_segement_params.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/actix_web_path_segement_params.rs b/examples/actix_web_path_segement_params.rs index e445144..100d74a 100644 --- a/examples/actix_web_path_segement_params.rs +++ b/examples/actix_web_path_segement_params.rs @@ -4,7 +4,8 @@ use actix_web::{get, test, web, App, HttpRequest, HttpResponse}; fn path_segment_param(req: HttpRequest, path: web::Path<(u32,)>) -> HttpResponse { // uri: /user/123, path: None, skip: 9, segments: [("id", Segment(6, 9))] dbg!(req.clone()); - println!("path.0 = {}", path.0.0); + let user_id: u32 = path.into_inner().0; + println!("path = {}", user_id); println!("&req.match_info()[\"id\"] = {}", &req.match_info()["id"]); println!( "req.match_info().query(\"id\") = {}", @@ -14,7 +15,7 @@ fn path_segment_param(req: HttpRequest, path: web::Path<(u32,)>) -> HttpResponse "req.match_info().get(\"id\").unwrap() = {}", req.match_info().get("id").unwrap() ); - HttpResponse::Ok().body("asdf") + HttpResponse::Ok().body("ok") } async fn test_path_segment_param() {