#web #http #potato

macro potato-macro

A very simple and high performance http library

25 releases

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

#2383 in Procedural macros

Download history 294/week @ 2025-01-10 430/week @ 2025-01-17 92/week @ 2025-01-24 22/week @ 2025-01-31 10/week @ 2025-02-07 5/week @ 2025-02-14 5/week @ 2025-02-21 90/week @ 2025-03-14 251/week @ 2025-03-21 202/week @ 2025-03-28 20/week @ 2025-04-04 94/week @ 2025-04-11 93/week @ 2025-04-18 101/week @ 2025-04-25

312 downloads per month
Used in potato

MIT license

17KB
335 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 res = potato::get("https://www.fawdlstty.com", vec![]).await?;
    println!("{}", String::from_utf8(res.body)?);
    Ok(())
}

更多示例

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

Dependencies

~1–1.8MB
~38K SLoC