Struct mailparsing::Header

source ·
pub struct Header<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Header<'a>

source

pub fn with_name_value<N: Into<SharedString<'a>>, V: Into<SharedString<'a>>>( name: N, value: V ) -> Self

source

pub fn new<N: Into<SharedString<'a>>>( name: N, value: impl EncodeHeaderValue ) -> Self

source

pub fn new_unstructured<N: Into<SharedString<'a>>, V: Into<SharedString<'a>>>( name: N, value: V ) -> Self

source

pub fn assign(&mut self, v: impl EncodeHeaderValue)

source

pub fn write_header<W: Write>(&self, out: &mut W) -> Result<()>

Format the header into the provided output stream, as though writing it out as part of a mime part

source

pub fn to_header_string(&self) -> String

Convenience method wrapping write_header that returns the formatted header as a standalone string

source

pub fn get_name(&self) -> &str

source

pub fn get_raw_value(&self) -> &str

source

pub fn as_content_transfer_encoding(&self) -> Result<MimeParameters>

source

pub fn as_content_disposition(&self) -> Result<MimeParameters>

source

pub fn as_content_type(&self) -> Result<MimeParameters>

source

pub fn as_mailbox_list(&self) -> Result<MailboxList>

Parse the header into a mailbox-list (as defined in RFC 5322), which is how the From and Resent-From, headers are defined.

source

pub fn as_mailbox(&self) -> Result<Mailbox>

Parse the header into a mailbox (as defined in RFC 5322), which is how the Sender and Resent-Sender headers are defined.

source

pub fn as_address_list(&self) -> Result<AddressList>

source

pub fn as_message_id(&self) -> Result<MessageID>

source

pub fn as_content_id(&self) -> Result<MessageID>

source

pub fn as_message_id_list(&self) -> Result<Vec<MessageID>>

source

pub fn as_unstructured(&self) -> Result<String>

source

pub fn as_authentication_results(&self) -> Result<AuthenticationResults>

source

pub fn as_date(&self) -> Result<DateTime<FixedOffset>>

source

pub fn parse_headers<S>(header_block: S) -> Result<HeaderParseResult<'a>>
where S: IntoSharedString<'a>,

source

pub fn parse<S: Into<SharedString<'a>>>( header_block: S ) -> Result<(Self, usize)>

source

pub fn rebuild(&self) -> Result<Self>

Re-constitute the header. The header value will be parsed out according to the known schema of the associated header name, and the parsed form used to build a new version of the header. This has the side effect of “fixing” non-conforming elements, but may come at the cost of “losing” the non-sensical or otherwise out of spec elements in the rebuilt header

Trait Implementations§

source§

impl<'a> Clone for Header<'a>

source§

fn clone(&self) -> Header<'a>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Header<'a>

source§

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

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

impl<'a> PartialEq for Header<'a>

source§

fn eq(&self, other: &Header<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> StructuralPartialEq for Header<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Header<'a>

§

impl<'a> RefUnwindSafe for Header<'a>

§

impl<'a> Send for Header<'a>

§

impl<'a> Sync for Header<'a>

§

impl<'a> Unpin for Header<'a>

§

impl<'a> UnwindSafe for Header<'a>

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

§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V