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

#537 in Network programming

Download history 754/week @ 2024-06-29 756/week @ 2024-07-06 868/week @ 2024-07-13 1009/week @ 2024-07-20 765/week @ 2024-07-27 633/week @ 2024-08-03 427/week @ 2024-08-10 342/week @ 2024-08-17 1612/week @ 2024-08-24 2122/week @ 2024-08-31 2543/week @ 2024-09-07 1905/week @ 2024-09-14 1853/week @ 2024-09-21 2020/week @ 2024-09-28 1292/week @ 2024-10-05 1415/week @ 2024-10-12

7,178 downloads per month
Used in 4 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

~2–13MB
~174K SLoC