#[repr(u8)]pub enum HeaderForm {
Raw = 0,
Text = 1,
Addresses = 2,
MessageIds = 3,
CommaList = 4,
Date = 5,
ContentType = 6,
Received = 7,
Ignore = 8,
}Expand description
How a header value is parsed.
Variants§
Raw = 0
The value as written, without leading and trailing whitespace.
Text = 1
Unstructured text with RFC 2047 encoded words decoded.
Addresses = 2
An address list: mailboxes and groups in document order.
MessageIds = 3
A list of message identifiers.
CommaList = 4
A comma-separated list of phrases.
Date = 5
An RFC 5322 date.
ContentType = 6
A Content-Type or Content-Disposition value.
Received = 7
A Received trace field.
Ignore = 8
Not parsed; the header is kept with an empty value.
Implementations§
Source§impl HeaderForm
impl HeaderForm
Sourcepub fn parse(self, value: &[u8]) -> ParsedValue<'_>
pub fn parse(self, value: &[u8]) -> ParsedValue<'_>
Parses a standalone header value: the bytes after the colon, up to the end of the field (a line break not followed by white space).
use mail_parser::HeaderForm;
let parsed = HeaderForm::Addresses.parse(b" Jane <jane@example.com>, bob@example.com\r\n");
let addresses = parsed.value().as_address().expect("addresses");
assert_eq!(addresses.mailboxes().count(), 2);
let parsed = HeaderForm::Date.parse(b" Sat, 20 Nov 2021 14:22:01 -0800\r\n");
let date = parsed.value().as_datetime().expect("date");
assert_eq!(date.to_timestamp(), 1_637_446_921);Trait Implementations§
Source§impl Clone for HeaderForm
impl Clone for HeaderForm
impl Copy for HeaderForm
Source§impl Debug for HeaderForm
impl Debug for HeaderForm
impl Eq for HeaderForm
Source§impl Hash for HeaderForm
impl Hash for HeaderForm
Source§impl PartialEq for HeaderForm
impl PartialEq for HeaderForm
impl StructuralPartialEq for HeaderForm
Auto Trait Implementations§
impl Freeze for HeaderForm
impl RefUnwindSafe for HeaderForm
impl Send for HeaderForm
impl Sync for HeaderForm
impl Unpin for HeaderForm
impl UnsafeUnpin for HeaderForm
impl UnwindSafe for HeaderForm
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