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

#496 in Network programming

Download history 756/week @ 2024-07-29 694/week @ 2024-08-05 365/week @ 2024-08-12 336/week @ 2024-08-19 1795/week @ 2024-08-26 2530/week @ 2024-09-02 2643/week @ 2024-09-09 1307/week @ 2024-09-16 1751/week @ 2024-09-23 2241/week @ 2024-09-30 1102/week @ 2024-10-07 1503/week @ 2024-10-14 2869/week @ 2024-10-21 2960/week @ 2024-10-28 1418/week @ 2024-11-04 2098/week @ 2024-11-11

9,408 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
~169K SLoC