#http #serde #deserialize #status #url

http-serde

Serde support for the http crate. (De)serialize HeaderMap, Uri, Method, StatusCode

2 stable releases

1.0.1 Mar 15, 2020
1.0.0 Feb 9, 2020

#400 in Encoding

Download history 523/week @ 2020-08-11 1545/week @ 2020-08-18 1336/week @ 2020-08-25 1026/week @ 2020-09-01 885/week @ 2020-09-08 1223/week @ 2020-09-15 1342/week @ 2020-09-22 1268/week @ 2020-09-29 1206/week @ 2020-10-06 1532/week @ 2020-10-13 1848/week @ 2020-10-20 2046/week @ 2020-10-27 1349/week @ 2020-11-03 1353/week @ 2020-11-10 1344/week @ 2020-11-17 793/week @ 2020-11-24

2,563 downloads per month
Used in 2 crates

Apache-2.0 OR MIT

12KB
209 lines

Serde support for the HTTP crate

Adds ability to serialize and deserialize types from the HTTP crate.

If you want to serialize Request or Response, use into_parts() and serialize their parts, and then rebuild them using their Builder.

Usage

You must annotate fields with #[serde(with = "http_serde::<appropriate method>")].

#[derive(Serialize, Deserialize)]
struct MyStruct {
    #[serde(with = "http_serde::method")]
    status: Method,

    #[serde(with = "http_serde::status")]
    status: StatusCode,

    #[serde(with = "http_serde::uri")]
    uri: Uri,

    #[serde(with = "http_serde::header_map")]
    headers: HeaderMap,
}

Requirements

Tested with Rust 1.41.


lib.rs:

Adds ability to serialize and deserialize types from the HTTP crate.

If you want to serialize Request or Response, use into_parts() and serialize their parts, and then rebuild them using their Builder.

Usage

You must annotate fields with #[serde(with = "http_serde::<appropriate method>")].

#[derive(Serialize, Deserialize)]
struct MyStruct {
    #[serde(with = "http_serde::method")]
    status: Method,

    #[serde(with = "http_serde::status")]
    status: StatusCode,

    #[serde(with = "http_serde::uri")]
    uri: Uri,

    #[serde(with = "http_serde::header_map")]
    headers: HeaderMap,
}

Dependencies

~1.1–1.7MB
~36K SLoC