📜  actix web - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:57.105000             🧑  作者: Mango

代码示例1
#[derive(Serialize)]
struct Measurement {
    temperature: f32,
}

async fn hello_world() -> impl Responder {
    "Hello World!"
}

async fn current_temperature() -> impl Responder {
    web::Json(Measurement { temperature: 42.3 })
}