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" "" }}