6 releases

0.3.2 Sep 20, 2024
0.3.1 Sep 13, 2024
0.2.0 May 14, 2024
0.1.2 Feb 23, 2024

#748 in Network programming

Download history 1853/week @ 2024-09-21 2020/week @ 2024-09-28 1292/week @ 2024-10-05 1419/week @ 2024-10-12 2803/week @ 2024-10-19 2926/week @ 2024-10-26 1562/week @ 2024-11-02 2083/week @ 2024-11-09 1021/week @ 2024-11-16 1389/week @ 2024-11-23 994/week @ 2024-11-30 927/week @ 2024-12-07 922/week @ 2024-12-14 428/week @ 2024-12-21 932/week @ 2024-12-28 1580/week @ 2025-01-04

4,046 downloads per month
Used in 10 crates (2 directly)

MIT/Apache

27KB
424 lines

http-request-derive rust library crate

Attention: this crate is still under development.

You can derive HttpRequest on a struct and annotate it with some attributes, so that it can be used to build a http::Request which can then be sent to a server. In addition, a response type can be read from the received http::Response.


lib.rs:

Attention: this crate is still under development.

You can derive HttpRequest on a struct and annotate it with some attributes, so that it can be used to build a http::Request which can then be sent to a server. In addition, a response type can be read from the received http::Response.

use http_request_derive::HttpRequest;
use serde::Deserialize;

#[derive(HttpRequest)]
#[http_request(method = "GET", response = MyResponse, path = "/books/{id}/abstract")]
struct MyRequest {
    #[http_request(query)]
    query: String,

    id: usize,
}

#[derive(Deserialize)]
struct MyResponse {}

Dependencies

~3–14MB
~172K SLoC