aboutsummaryrefslogtreecommitdiff
path: root/src/headermap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/headermap.rs')
-rw-r--r--src/headermap.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/headermap.rs b/src/headermap.rs
deleted file mode 100644
index 8712df1..0000000
--- a/src/headermap.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use crate::headers::Header;
-use anyhow::Result;
-use std::fmt::Display;
-
-pub struct HeaderMap(pub Vec<(String, String)>);
-
-impl HeaderMap {
- pub fn new() -> Self {
- Self(vec![])
- }
- pub fn add<H: Header>(mut self, h: H) -> Self {
- self.0.push((H::NAME.to_string(), format!("{h}")));
- self
- }
- pub fn get<H: Header>(&self) -> Option<Result<H>> {
- self.0
- .iter()
- .find(|(k, _)| k == H::NAME)
- .map(|(_, v)| H::from_str(v))
- }
-}
-
-impl Display for HeaderMap {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- for (k, v) in &self.0 {
- write!(f, "{k}: {v}\r\n")?;
- }
- Ok(())
- }
-}