Expand description
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 {}
Enums§
- Error
- Errors that originate from this crate
Traits§
- From
Http Response - Trait for types that can be converted from
http::Response
- Http
Request - A trait implemented for types that are sent to the API as parameters
- Http
Request Body - Trait defined on every body type that can be used with
crate::HttpRequest
. - Http
Request Query Params - A trait implemented by entities tha can build a HTTP request query string
Derive Macros§
- Http
Request HttpRequest
can be derived by structs that needs to implement theHttpRequest
trait.