Struct MessagePart

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

MIME Message Part

Fields§

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

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/html

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<'x>]

Get the message headers

Source

pub fn raw_len(&self) -> u32

Returns the body raw length

Source

pub fn raw_header_offset(&self) -> u32

Get the raw header offset of this part

Source

pub fn raw_body_offset(&self) -> u32

Get the raw body offset of this part

Source

pub fn raw_end_offset(&self) -> u32

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 Display for MessagePart<'_>

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<'x>>

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<'x>>

Returns the Content-Type field
Source§

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

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

Source§

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

Source§

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

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.