[][src]Struct mailparse::MailHeader

pub struct MailHeader<'a> { /* fields omitted */ }

A struct that represents a single header in the message. It holds slices into the raw byte array passed to parse_mail, and so the lifetime of this struct must be contained within the lifetime of the raw input. There are additional accessor functions on this struct to extract the data as Rust strings.

Methods

impl<'a> MailHeader<'a>[src]

pub fn get_key(&self) -> Result<String, MailParseError>[src]

Get the name of the header. Note that header names are case-insensitive.

pub fn get_value(&self) -> Result<String, MailParseError>[src]

Get the value of the header. Any sequences of newlines characters followed by whitespace are collapsed into a single space. In effect, header values wrapped across multiple lines are compacted back into one line, while discarding the extra whitespace required by the MIME format. Additionally, any quoted-printable words in the value are decoded.

Examples

    use mailparse::parse_header;
    let (parsed, _) = parse_header(b"Subject: =?iso-8859-1?Q?=A1Hola,_se=F1or!?=").unwrap();
    assert_eq!(parsed.get_key().unwrap(), "Subject");
    assert_eq!(parsed.get_value().unwrap(), "\u{a1}Hola, se\u{f1}or!");

Trait Implementations

impl<'a> Debug for MailHeader<'a>[src]

Auto Trait Implementations

impl<'a> Send for MailHeader<'a>

impl<'a> Sync for MailHeader<'a>

impl<'a> Unpin for MailHeader<'a>

impl<'a> UnwindSafe for MailHeader<'a>

impl<'a> RefUnwindSafe for MailHeader<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]