#[derive(Debug, Default, Clone)]
pub struct Headers(Vec<(&'static str, String)>);
impl Headers {
pub fn none() -> Option<Headers> {
None
}
pub fn add<V>(&mut self, key: &'static str, val: V)
where
V: Into<String>,
{
self.0.push((key, val.into()))
}
pub fn single<V>(key: &'static str, val: V) -> Self
where
V: Into<String>,
{
let mut h = Self::default();
h.add(key, val);
h
}
}
impl IntoIterator for Headers {
type Item = (&'static str, String);
type IntoIter = std::vec::IntoIter<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}