Rust 另一个 Web 服务器框架
Yet another web server framework for rust.
Installation:
[dependencies]
rweb = "0.6"
tokio = "1"Installation (with automatic openapi generation):
[dependencies]
rweb = { version = "0.6", features = ["openapi"] }
serde = "1"
tokio = "1"Since rweb is based on warp, which features safety and correctness, rweb has same property.
…If you want to use websocket, just declare a parameter typed Ws. It's all.
use rweb::*;
#[get("/ws")]
fn example(ws: ws::Ws) -> String {
String::new("use ws.on_upgrade or extra")
}rweb supports automatically generating openapi specification file based on your code.
See: documentation for usage.
// Build openapi for your API
let (spec, filter) = openapi::spec().build(move || {
// Your API's filters
math::math()
.or(products::products())
.or(generic::body())
.or(generic::optional())
.or(generic::search())
.or(response::response())
});
println!("go to http://localhost:3030/docs to interact with your openapi!");
serve(filter.or(openapi_docs(spec)))
.run(([127, 0, 0, 1], 3030))
.await;| Name | rweb | actix-web | gotham | iron | nickel | rocket | rouille | Thruster | Tide | tower-web | warp |
|---|---|---|---|---|---|---|---|---|---|---|---|
| License | |||||||||||
| Version | |||||||||||
| Recent downloads | |||||||||||
| Github stars | |||||||||||
| Contributors | |||||||||||
| Activity | |||||||||||
| Base framework | hyper / warp | tokio | hyper | hyper | hyper | hyper | tiny-http | tokio | hyper | hyper | hyper |
| https | Y | Y | Y | ? | ? | ? | ? | ? | ? | ? | Y |
| http 2 | Y | Y | ? | ? | ? | ? | ? | ? | ? | ? | Y |
| async | Y | Y | Y | Y | Y | Y | Y (via different method) | ||||
| stable rust | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | |
| openapi support | Y |
暂无开放 Issues,或尚未同步最近议题。