#web #http #potato

macro potato-macro

A very simple and high performance http library

24 releases

new 0.2.0 Apr 17, 2025
0.1.32 Mar 28, 2025
0.1.23 Jan 23, 2025
0.1.6 Dec 29, 2024

#2357 in Procedural macros

Download history 442/week @ 2024-12-25 756/week @ 2025-01-01 269/week @ 2025-01-08 302/week @ 2025-01-15 264/week @ 2025-01-22 11/week @ 2025-01-29 23/week @ 2025-02-05 3/week @ 2025-02-12 8/week @ 2025-02-19 44/week @ 2025-03-12 150/week @ 2025-03-19 341/week @ 2025-03-26 26/week @ 2025-04-02 16/week @ 2025-04-09

577 downloads per month
Used in potato

MIT license

17KB
341 lines

potato

version status

高性能、简洁语法的HTTP框架。

用法

加入库的引用:

cargo add potato
cargo add tokio --features full

Hello Server

use potato::*;

// http://127.0.0.1:8080/hello
#[http_get("/hello")]
async fn hello() -> HttpResponse {
    HttpResponse::html("hello world")
}

#[tokio::main]
async fn main() {
    let mut server = HttpServer::new("0.0.0.0:8080");
    _ = server.serve_http().await;
}

Hello Client

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let r = potato::get("https://www.fawdlstty.com").await?;
    println!("{}", String::from_utf8(res.body)?);
    Ok(())
}

更多示例

请参考:https://github.com/fawdlstty/potato/tree/main/examples

Dependencies

~0.9–1.8MB
~38K SLoC