Crates.io | serde_header |
lib.rs | serde_header |
version | 0.2.0 |
source | src |
created_at | 2020-09-15 07:15:38.464018 |
updated_at | 2020-09-17 05:32:00.061908 |
description | Strongly typed HTTP Header library for Rust, built upon serde |
homepage | https://github.com/Xuanwo/serde_header |
repository | https://github.com/Xuanwo/serde_header |
max_upload_size | |
id | 288833 |
size | 14,342 |
Strongly typed HTTP Header library for Rust, built upon serde
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)