#http-header #serde #typed #built #upon #header-parser

serde_header

Strongly typed HTTP Header library for Rust, built upon serde

3 unstable releases

0.2.0 Sep 17, 2020
0.1.1 Sep 16, 2020
0.1.0 Sep 15, 2020

#19 in #upon

23 downloads per month

Apache-2.0

13KB
342 lines

serde_header

Strongly typed HTTP Header library for Rust, built upon serde

Quick start

use serde_header::from_http_header_map;

#[derive(Deserialize, Debug)]
struct Example {
    content_length: i64,
    content_type: String,
}

// let mut h = http::header::HeaderMap::new();
// h.insert("content_length", "100".parse().unwrap());
// h.insert("content_type", "application/json".parse().unwrap());

let t: Example = from_http_header_map(&h).unwrap();

println!("{:?}", &t)

Dependencies

~0.5–1.3MB
~28K SLoC