From cbf046b1f05da061abfbc64905d97c60553c6b77 Mon Sep 17 00:00:00 2001 From: Cameron Dershem Date: Fri, 28 Jun 2019 12:09:51 -0400 Subject: [PATCH] updates flexible responders. --- examples/flexible-responders/src/main.rs | 2 +- layouts/index.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/flexible-responders/src/main.rs b/examples/flexible-responders/src/main.rs index dbe8e28..1459ca1 100644 --- a/examples/flexible-responders/src/main.rs +++ b/examples/flexible-responders/src/main.rs @@ -11,7 +11,7 @@ fn hello_world() -> impl Responder { "Hello World!" } -fn current_temperature(_req: HttpRequest) -> impl Responder { +fn current_temperature() -> impl Responder { web::Json(Measurement { temperature: 42.3 }) } diff --git a/layouts/index.html b/layouts/index.html index 4b0fd05..53c147c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -70,6 +70,7 @@ fn main() { to return consistent responses from your APIs.

{{ highlight `#[derive(Serialize)] +#[derive(Serialize)] struct Measurement { temperature: f32, } @@ -78,7 +79,7 @@ fn hello_world() -> impl Responder { "Hello World!" } -fn current_temperature(_req: HttpRequest) -> impl Responder { +fn current_temperature() -> impl Responder { web::Json(Measurement { temperature: 42.3 }) }` "rust" "" }}