1
0
Fork
You've already forked smol-axum
0
forked from notgull/smol-axum
Integrations between smol and axum
  • Rust 100%
2026年02月18日 00:03:51 +00:00
.woodpecker ci: Update CI pipelines to Woodpecker v3 2026年02月14日 13:46:44 -08:00
examples Documentation 2023年12月29日 12:50:38 -08:00
src breaking: Add Sync bound to executor 2026年02月15日 02:36:57 +01:00
.gitignore Initial commit 2023年12月29日 12:23:03 -08:00
Cargo.lock chore(deps): update rust crate async-executor to v1.14.0 2026年02月18日 00:03:51 +00:00
Cargo.toml v0.2.1 2026年02月14日 17:40:45 -08:00
CHANGELOG.md v0.2.1 2026年02月14日 17:40:45 -08:00
LICENSE-APACHE Documentation 2023年12月29日 12:50:38 -08:00
LICENSE-MIT Documentation 2023年12月29日 12:50:38 -08:00
README.md Documentation 2023年12月29日 12:50:38 -08:00
renovate.json chore: Configure Renovate 2024年04月20日 20:51:54 +00:00

smol-axum

Integrations between smol and axum.

By default, axum only supports the tokio runtime. This crate adds a serve function that can be used with smol's networking types.

Examples

useasync_io::Async;useaxum::{response::Html,routing::get,Router};usemacro_rules_attribute::apply;usestd::io;usestd::net::TcpListener;usestd::sync::Arc;#[apply(smol_macros::main!)]asyncfn main(ex: &Arc<smol_macros::Executor<'_>>)-> io::Result<()>{// Build our application with a route.
letapp=Router::new().route("/",get(handler));// Create a `smol`-based TCP listener.
letlistener=Async::<TcpListener>::bind(([127,0,0,1],3000)).unwrap();println!("listening on {}",listener.get_ref().local_addr().unwrap());// Run it using `smol_axum`
smol_axum::serve(ex.clone(),listener,app).await}asyncfn handler()-> Html<&'staticstr>{Html("<h1>Hello, World!</h1>")}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.