Skip to content

Commit e9c9d49

Browse files
perf: switch plaintext and json to one runtime per thread, improving performance.
1 parent 7aca29c commit e9c9d49

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

frameworks/Rust/axum/src/main.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ pub async fn json() -> impl IntoResponse {
2626
(StatusCode::OK, Json(message))
2727
}
2828

29-
#[tokio::main]
30-
async fn main() {
29+
fn main() {
3130
dotenv().ok();
31+
server::start_tokio(serve_app)
32+
}
33+
34+
async fn serve_app() {
3235

3336
let app = Router::new()
3437
.route("/plaintext", get(plaintext))
3538
.route("/json", get(json));
3639

3740
server::serve_hyper(app, Some(8000)).await
38-
}
41+
}

0 commit comments

Comments
 (0)