maker_web 0.1.0

High-performance, zero-allocation HTTP server for microservices
Documentation

maker_web

License: MIT License: Apache-2.0 Downloads Crates.io Documentation

Features

  • ⚡ High Performance - Zero-allocation design, pre-calculated buffers
  • 🔧 Fine-grained Control - Precise memory, connection, and protocol configuration
  • 🔄 Multi-protocol - HTTP/1.1, HTTP/1.0, and HTTP/0.9+ support
  • 🎯 Async Ready - Built on Tokio for scalable I/O
  • 📊 Predictable Memory - Pre-allocated memory per connection

Quick Start

Add to Cargo.toml:

[dependencies]
maker_web = "0.1"
tokio = { version = "1", features = ["full"] }

Basic example

use maker_web::{Handled, Handler, Request, Response, Server, StatusCode};
use tokio::net::TcpListener;

struct MyHandler;

impl Handler<()> for MyHandler {
    async fn handle(&self, _: &mut (), req: &Request, resp: &mut Response) -> Handled {
        match req.url().path_segments() {
            [b"api", user, b"name"] => {
                resp.status(StatusCode::Ok).body(user)
            }
            [b"api", user, b"name", b"len"] => {
                resp.status(StatusCode::Ok).body(user.len())
            }
            [b"api", b"echo", text] => {
                resp.status(StatusCode::Ok).body(text)
            }
            _ => resp.status(StatusCode::NotFound).body("qwe"),
        }
    }
}

#[tokio::main]
async fn main() {
    Server::builder()
        .listener(TcpListener::bind("127.0.0.1:8080").await.unwrap())
        .handler(MyHandler)
        .build()
        .launch()
        .await;
}

Examples

Check the examples directory for comprehensive usage examples.

Support the author

Visit the support page to learn how you can support this project.

License

maker_web is licensed under either of the following, at your option: