mirror of
https://github.com/actix/actix-website
synced 2024-11-30 11:12:57 +01:00
updates flexible responders.
This commit is contained in:
parent
4833874c5d
commit
cbf046b1f0
@ -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 })
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ fn main() {
|
||||
to return consistent responses from your APIs.
|
||||
</p>
|
||||
{{ 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" "" }}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user