Debian Codegraph @

third_party/rust/headers/src/util/fmt.rs

raw
1 use std::fmt::Display;
2
3 use HeaderValue;
4
5 pub(crate) fn fmt<T: Display>(fmt: T) -> HeaderValue {
6 let s = fmt.to_string();
7 match HeaderValue::from_maybe_shared(s) {
8 Ok(val) => val,
9 Err(err) => panic!("illegal HeaderValue; error = {:?}, fmt = \"{}\"", err, fmt),
10 }
11 }