MCPcopy Create free account
hub / github.com/GlenDC/github-rust / get_single_header_value

Function get_single_header_value

src/response.rs:58–63  ·  view source on GitHub ↗

Get a single raw header value for type `T` using its default value when str::parse failed

(raw_data: &HttpHeaderType, key: &str)

Source from the content-addressed store, hash-verified

56/// Get a single raw header value for type `T`
57/// using its default value when str::parse failed
58fn get_single_header_value<T>(raw_data: &HttpHeaderType, key: &str) -> T where T: Default + FromStr {
59 match str::parse(&raw_data[key][0]) {
60 Ok(x) => x,
61 Err(..) => Default::default(),
62 }
63}
64
65impl Populatable for Rate {
66 /// `populate` a `Rate<T>` object from the HTTP response header

Callers 1

populateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected