containers_api/conn/
headers.rs1#[derive(Debug, Default, Clone)]
2pub struct Headers(Vec<(&'static str, String)>);
4
5impl Headers {
6 pub fn none() -> Option<Headers> {
8 None
9 }
10
11 pub fn add<V>(&mut self, key: &'static str, val: V)
13 where
14 V: Into<String>,
15 {
16 self.0.push((key, val.into()))
17 }
18
19 pub fn single<V>(key: &'static str, val: V) -> Self
22 where
23 V: Into<String>,
24 {
25 let mut h = Self::default();
26 h.add(key, val);
27 h
28 }
29}
30
31impl IntoIterator for Headers {
32 type Item = (&'static str, String);
33 type IntoIter = std::vec::IntoIter<Self::Item>;
34
35 fn into_iter(self) -> Self::IntoIter {
36 self.0.into_iter()
37 }
38}