mail_parser

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: 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 get_contents(&'x self) -> &'x [u8]

Returns the body part’s contents as a u8 slice

Source

pub fn get_text_contents(&'x self) -> Option<&'x str>

Returns the body part’s contents as a str

Source

pub fn get_message(&'x self) -> Option<Cow<'x, Message<'x>>>

Returns the nested message

Source

pub fn get_sub_parts(&'x 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 offset_end_offset(&self) -> usize

Get the raw body end offset of 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<'de: 'x, 'x> Deserialize<'de> for MessagePart<'x>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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 get_content_description(&self) -> Option<&str>

Returns the Content-Description field
Source§

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

Returns the Content-Disposition field
Source§

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

Returns the Content-ID field
Source§

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

Returns the Content-Encoding field
Source§

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

Returns the Content-Type field
Source§

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

Returns the Content-Language field
Source§

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

Returns the Content-Location field
Source§

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

Returns the attachment name, if any.
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> Serialize for MessagePart<'x>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,