#http-header #serde #upon #typed #built #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

#20 in #upon

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