Skip to main content

HeaderValue

Enum HeaderValue 

Source
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>

Source

pub fn is_empty(&self) -> bool

Whether the value is HeaderValue::Empty.

Source

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).

Source

pub fn as_text_list(&self) -> Option<TextList<'m>>

The text list.

Source

pub fn as_address(&self) -> Option<AddressList<'m>>

The address list.

Source

pub fn as_datetime(&self) -> Option<DateTime>

The date.

Source

pub fn as_content_type(&self) -> Option<ContentType<'m>>

The Content-Type or Content-Disposition value.

Source

pub fn as_received(&self) -> Option<Received<'m>>

The Received trace field.

Trait Implementations§

Source§

impl<'m> Clone for HeaderValue<'m>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'m> Copy for HeaderValue<'m>

Source§

impl<'m> Debug for HeaderValue<'m>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'m> Default for HeaderValue<'m>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'m> Eq for HeaderValue<'m>

Source§

impl<'m> PartialEq for HeaderValue<'m>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'m> StructuralPartialEq for HeaderValue<'m>

Auto Trait Implementations§

§

impl<'m> Freeze for HeaderValue<'m>

§

impl<'m> RefUnwindSafe for HeaderValue<'m>

§

impl<'m> Send for HeaderValue<'m>

§

impl<'m> Sync for HeaderValue<'m>

§

impl<'m> Unpin for HeaderValue<'m>

§

impl<'m> UnsafeUnpin for HeaderValue<'m>

§

impl<'m> UnwindSafe for HeaderValue<'m>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.