pub enum HeaderValue<'m> {
Empty,
Text(&'m str),
TextList(TextList<'m>),
Address(AddressList<'m>),
DateTime(DateTime),
ContentType(ContentType<'m>),
Received(Received<'m>),
}Expand description
A parsed header value. The variant follows the HeaderForm the parser
used for the name (see crate::MessageParser::header). Values compare
by content.
Variants§
Empty
No parsable value: a value that does not parse in its form (an empty
address list, date or Content-Type included), or a field parsed with
HeaderForm::Ignore.
Text(&'m str)
The trimmed field (HeaderForm::Raw) or its decoded text
(HeaderForm::Text); an empty string for a field that is present
but blank.
TextList(TextList<'m>)
Message identifiers (HeaderForm::MessageIds) or phrases
(HeaderForm::CommaList); always a list, even with one item.
Address(AddressList<'m>)
Mailboxes and groups (HeaderForm::Addresses).
DateTime(DateTime)
A date (HeaderForm::Date).
ContentType(ContentType<'m>)
A Content-Type or Content-Disposition value
(HeaderForm::ContentType).
Received(Received<'m>)
A Received trace field (HeaderForm::Received).
Implementations§
Source§impl<'m> HeaderValue<'m>
impl<'m> HeaderValue<'m>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the value is HeaderValue::Empty.
Sourcepub fn as_text(&self) -> Option<&'m str>
pub fn as_text(&self) -> Option<&'m str>
The text, or the last item of a text list (the identifier of a Message-ID field, for instance).
Sourcepub fn as_text_list(&self) -> Option<TextList<'m>>
pub fn as_text_list(&self) -> Option<TextList<'m>>
The text list.
Sourcepub fn as_address(&self) -> Option<AddressList<'m>>
pub fn as_address(&self) -> Option<AddressList<'m>>
The address list.
Sourcepub fn as_datetime(&self) -> Option<DateTime>
pub fn as_datetime(&self) -> Option<DateTime>
The date.
Sourcepub fn as_content_type(&self) -> Option<ContentType<'m>>
pub fn as_content_type(&self) -> Option<ContentType<'m>>
The Content-Type or Content-Disposition value.
Sourcepub fn as_received(&self) -> Option<Received<'m>>
pub fn as_received(&self) -> Option<Received<'m>>
The Received trace field.