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

#643 in Network programming

Download history 1316/week @ 2024-10-03 1342/week @ 2024-10-10 2010/week @ 2024-10-17 3477/week @ 2024-10-24 1796/week @ 2024-10-31 1677/week @ 2024-11-07 1724/week @ 2024-11-14 1243/week @ 2024-11-21 1202/week @ 2024-11-28 718/week @ 2024-12-05 1049/week @ 2024-12-12 567/week @ 2024-12-19 389/week @ 2024-12-26 1765/week @ 2025-01-02 1180/week @ 2025-01-09 390/week @ 2025-01-16

3,780 downloads per month
Used in 10 crates (via opentalk-client-shared)

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
~173K SLoC