pub struct MessagePart<'x> {
    pub headers: Vec<Header<'x>>,
    pub is_encoding_problem: bool,
    pub body: PartType<'x>,
    pub encoding: Encoding,
    pub offset_header: usize,
    pub offset_body: usize,
    pub offset_end: usize,
}
Expand description

MIME Message Part

Fields§

§headers: Vec<Header<'x>>§is_encoding_problem: bool§body: PartType<'x>§encoding: Encoding§offset_header: usize§offset_body: usize§offset_end: usize

Implementations§

source§

impl<'x> MessagePart<'x>

source

pub fn contents(&self) -> &[u8]

Returns the body part’s contents as a u8 slice

source

pub fn text_contents(&self) -> Option<&str>

Returns the body part’s contents as a str

source

pub fn message(&self) -> Option<&Message<'x>>

Returns the nested message

source

pub fn sub_parts(&self) -> Option<&[MessagePartId]>

Returns the sub parts ids of a MIME part

source

pub fn len(&self) -> usize

Returns the body part’s length

source

pub fn is_text(&self) -> bool

Returns true when the body part MIME type is text/*

source

pub fn is_text_html(&self) -> bool

Returns true when the body part MIME type is text/tml

source

pub fn is_binary(&self) -> bool

Returns true when the part is binary

source

pub fn is_multipart(&self) -> bool

Returns true when the part is multipart

source

pub fn is_message(&self) -> bool

Returns true when the part is a nested message

source

pub fn is_empty(&self) -> bool

Returns true when the body part is empty

source

pub fn headers(&self) -> &[Header<'_>]

Get the message headers

source

pub fn raw_len(&self) -> usize

Returns the body raw length

source

pub fn raw_header_offset(&self) -> usize

Get the raw header offset of this part

source

pub fn raw_body_offset(&self) -> usize

Get the raw body offset of this part

source

pub fn raw_end_offset(&self) -> usize

Get the raw body end offset of this part

source

pub fn into_owned(self) -> MessagePart<'static>

Returns an owned version of the this part

Trait Implementations§

source§

impl<'x> Clone for MessagePart<'x>

source§

fn clone(&self) -> MessagePart<'x>

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<'x> Debug for MessagePart<'x>

source§

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

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

impl<'x> Default for MessagePart<'x>

source§

fn default() -> MessagePart<'x>

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

impl<'x> Display for MessagePart<'x>

source§

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

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

impl<'x> MimeHeaders<'x> for MessagePart<'x>

source§

fn content_description(&self) -> Option<&str>

Returns the Content-Description field
source§

fn content_disposition(&self) -> Option<&ContentType<'_>>

Returns the Content-Disposition field
source§

fn content_id(&self) -> Option<&str>

Returns the Content-ID field
source§

fn content_transfer_encoding(&self) -> Option<&str>

Returns the Content-Encoding field
source§

fn content_type(&self) -> Option<&ContentType<'_>>

Returns the Content-Type field
source§

fn content_language(&self) -> &HeaderValue<'_>

Returns the Content-Language field
source§

fn content_location(&self) -> Option<&str>

Returns the Content-Location field
source§

fn attachment_name(&self) -> Option<&str>

Returns the attachment name, if any.
source§

fn is_content_type(&self, type_: &str, subtype: &str) -> bool

source§

impl<'x> PartialEq for MessagePart<'x>

source§

fn eq(&self, other: &MessagePart<'x>) -> 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<'x> StructuralPartialEq for MessagePart<'x>

Auto Trait Implementations§

§

impl<'x> Freeze for MessagePart<'x>

§

impl<'x> RefUnwindSafe for MessagePart<'x>

§

impl<'x> Send for MessagePart<'x>

§

impl<'x> Sync for MessagePart<'x>

§

impl<'x> Unpin for MessagePart<'x>

§

impl<'x> UnwindSafe for MessagePart<'x>

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.