potato

Crates.iopotato
lib.rspotato
version0.2.13
created_at2024-12-18 16:03:30.196417+00
updated_at2025-09-23 14:13:57.806564+00
descriptionA very simple and high performance http library.
homepagehttps://github.com/fawdlstty/potato
repositoryhttps://github.com/fawdlstty/potato
max_upload_size
id1488166
size11,375,221
Fawdlstty (fawdlstty)

documentation

README

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

Commit count: 113

cargo fmt