| Crates.io | async_tiny |
| lib.rs | async_tiny |
| version | 0.4.0 |
| created_at | 2025-09-05 11:39:45.503446+00 |
| updated_at | 2025-10-20 12:16:17.519055+00 |
| description | A minimal async HTTP server with a tiny_http-like feel, built on Hyper 1.x |
| homepage | |
| repository | https://github.com/Pjdur/async_tiny |
| max_upload_size | |
| id | 1825384 |
| size | 38,014 |
A minimal async HTTP server with a tiny_http-like feel, built on Hyper 1.x.
async_tiny is designed for simplicity: it gives you a clean, buffered request loop without exposing Hyper internals or requiring complex async plumbing. Ideal for small web apps, embedded tools, or frameworks like Velto.
Bytes)Request and Response typeswhile let Some(req) = server.next().awaitreq.respond(Response)use async_tiny::{Server, Response};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let mut server = Server::http("127.0.0.1:8080", false).await?;
while let Some(request) = server.next().await {
let response = Response::from_string("Hello from async_tiny!");
let _ = request.respond(response);
}
Ok(())
}
⚠️ Note: If you want to use
#[tokio::main]in your own code, you must add Tokio to your project manually:cargo add tokioAlthough this crate depends on Tokio internally, Rust requires that procedural macros like
#[tokio::main]be declared directly in your own Cargo.toml to work properly.
struct Request {
fn url(&self) -> &str
fn method(&self) -> &Method
fn headers(&self) -> &HeaderMap
fn body(&self) -> &Bytes
fn respond(self, Response) -> Result<(), RespondError>
}
Response::from_string("Hello")
Response::from_data(vec![1, 2, 3])
Response::from_status_and_string(404, "Not Found")
Response::empty(204)
.with_content_type("text/plain")
.with_header(Header::from_str("X-Custom: Value")?)
Suppress internal logging (e.g. connection errors, startup messages):
let server = Server::http("127.0.0.1:8080", true).await?;
MIT
Open an issue or reach out via GitHub Discussions if you have ideas, bugs, or suggestions.