35个重大版本发布
0.47.0 | 2024年7月23日 |
---|---|
0.45.0 | 2024年5月13日 |
0.42.0 | 2024年3月18日 |
0.35.2 | 2023年12月21日 |
0.13.0 | 2023年3月27日 |
686 在 HTTP服务器
126 每月下载
32KB
507 行
Thruster网络框架的Shuttle服务集成
示例
use thruster::{
context::basic_hyper_context::{generate_context, BasicHyperContext as Ctx, HyperRequest},
m, middleware_fn, App, HyperServer, MiddlewareNext, MiddlewareResult, ThrusterServer,
};
#[middleware_fn]
async fn hello(mut context: Ctx, _next: MiddlewareNext<Ctx>) -> MiddlewareResult<Ctx> {
context.body("Hello, World!");
Ok(context)
}
#[shuttle_runtime::main]
async fn thruster() -> shuttle_thruster::ShuttleThruster<HyperServer<Ctx, ()>> {
let server = HyperServer::new(
App::<HyperRequest, Ctx, ()>::create(generate_context, ()).get("/", m![hello]),
);
Ok(server.into())
}
依赖关系
~16–27MB
~401K SLoC