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

#56 in #header-parser

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.2MB
~26K SLoC