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

#515 in Network programming

Download history 316/week @ 2024-08-16 1232/week @ 2024-08-23 2135/week @ 2024-08-30 2453/week @ 2024-09-06 1815/week @ 2024-09-13 2309/week @ 2024-09-20 1798/week @ 2024-09-27 1443/week @ 2024-10-04 1216/week @ 2024-10-11 2779/week @ 2024-10-18 3165/week @ 2024-10-25 1424/week @ 2024-11-01 2126/week @ 2024-11-08 1185/week @ 2024-11-15 1212/week @ 2024-11-22 1214/week @ 2024-11-29

5,941 downloads per month
Used in 9 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