Skip to content

Commit c8bb649

Browse files
committed
feat(header-plz): implemented HMap::has_header
1 parent 09e71b5 commit c8bb649

File tree

1 file changed

+15
-4
lines changed
  • header-plz/src/message_head/header_map

1 file changed

+15
-4
lines changed

header-plz/src/message_head/header_map/mod.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ where
4343

4444
impl<'a, T> HMap<T>
4545
where
46-
T: Hmap + std::fmt::Debug,
46+
T: Hmap,
4747
{
4848
pub fn new() -> Self {
4949
HMap {
@@ -105,10 +105,17 @@ where
105105
})
106106
}
107107

108+
pub fn has_header<H>(&self, hdr: H) -> bool
109+
where
110+
T: From<H>,
111+
{
112+
self.header_position(hdr).is_some()
113+
}
114+
108115
// ----- update
109116
// old : Content-Length: 20
110117
// new : Content-Length: 10
111-
pub fn update_header_all<K>(&mut self, old: K, new: K) -> bool
118+
pub fn update_header_all<K>(&'a mut self, old: K, new: K) -> bool
112119
where
113120
T: From<K>,
114121
{
@@ -150,7 +157,7 @@ where
150157
result
151158
}
152159

153-
pub fn remove_header_all<K>(&mut self, to_remove: K) -> bool
160+
pub fn remove_header_all<K>(&'a mut self, to_remove: K) -> bool
154161
where
155162
T: From<K>,
156163
{
@@ -221,7 +228,11 @@ where
221228
}
222229

223230
// ----- update
224-
pub fn update_header_key_all<K>(&mut self, old_key: K, new_key: K) -> bool
231+
pub fn update_header_key_all<K>(
232+
&'a mut self,
233+
old_key: K,
234+
new_key: K,
235+
) -> bool
225236
where
226237
K: AsRef<[u8]>,
227238
{

0 commit comments

Comments
 (0)