pub struct HeaderMap { /* private fields */ }
Expand description
A collection of Headers [unstable]
Implementations§
Source§impl HeaderMap
impl HeaderMap
Sourcepub fn insert(&mut self, header: Header)
pub fn insert(&mut self, header: Header)
Adds a header to the collection [unstable]
Examples found in repository?
examples/printing.rs (lines 17-36)
5fn main() {
6 let parts = vec![
7 MimeMessage::new("First part".to_string()),
8 MimeMessage::new("Second part".to_string()),
9 ];
10
11 let mut message = MimeMessage::new("Parent".to_string());
12
13 for part in parts.into_iter() {
14 message.children.push(part);
15 }
16
17 message.headers.insert(
18 Header::new_with_value(
19 "To".to_string(),
20 vec![
21 Address::new_mailbox_with_name(
22 "John Doe".to_string(),
23 "john@example.org".to_string(),
24 ),
25 Address::new_mailbox_with_name(
26 "Joe Blogs".to_string(),
27 "joe@example.org".to_string(),
28 ),
29 Address::new_mailbox_with_name(
30 "Mr Black".to_string(),
31 "mafia_black@example.org".to_string(),
32 ),
33 ],
34 )
35 .unwrap(),
36 );
37
38 message.update_headers();
39
40 println!("{}", message.as_string());
41}
pub fn replace(&mut self, header: Header)
Sourcepub fn iter(&self) -> HeaderIter<'_> ⓘ
pub fn iter(&self) -> HeaderIter<'_> ⓘ
Get an Iterator over the collection of headers. [unstable]
Sourcepub fn get(&self, name: String) -> Option<&Header>
pub fn get(&self, name: String) -> Option<&Header>
Get the last value of the header with name
[unstable]
Sourcepub fn get_value<T: FromHeader>(&self, name: String) -> ParsingResult<T>
pub fn get_value<T: FromHeader>(&self, name: String) -> ParsingResult<T>
Get the last value of the header with name
, as a decoded type.
[unstable]
pub fn is_empty(&self) -> bool
Trait Implementations§
impl Eq for HeaderMap
impl StructuralPartialEq for HeaderMap
Auto Trait Implementations§
impl Freeze for HeaderMap
impl RefUnwindSafe for HeaderMap
impl Send for HeaderMap
impl Sync for HeaderMap
impl Unpin for HeaderMap
impl UnwindSafe for HeaderMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more