📜  如何制作 rust 服务器 - 任何代码示例

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

代码示例1
// Install rocket and add to your Cargo.toml

#[macro_use] extern crate rocket;

#[get("/hello//")]
fn hello(name: &str, age: u8) -> String {
    format!("Hello, {} year old named {}!", age, name)
}

#[launch]
fn rocket() -> _ {
    rocket::build().mount("/", routes![hello])
}