Struct mail_builder::mime::MimePart

source ·
pub struct MimePart<'x> {
    pub headers: Vec<(Cow<'x, str>, HeaderType<'x>)>,
    pub contents: BodyPart<'x>,
}
Expand description

MIME part of an e-mail.

Fields§

§headers: Vec<(Cow<'x, str>, HeaderType<'x>)>§contents: BodyPart<'x>

Implementations§

source§

impl<'x> MimePart<'x>

source

pub fn new( content_type: impl Into<ContentType<'x>>, contents: impl Into<BodyPart<'x>> ) -> Self

Create a new MIME part.

source

pub fn attachment(self, filename: impl Into<Cow<'x, str>>) -> Self

Set the attachment filename of a MIME part.

source

pub fn inline(self) -> Self

Set the MIME part as inline.

source

pub fn language(self, value: impl Into<Cow<'x, str>>) -> Self

Set the Content-Language header of a MIME part.

source

pub fn cid(self, value: impl Into<Cow<'x, str>>) -> Self

Set the Content-ID header of a MIME part.

source

pub fn location(self, value: impl Into<Cow<'x, str>>) -> Self

Set the Content-Location header of a MIME part.

source

pub fn header( self, header: impl Into<Cow<'x, str>>, value: impl Into<HeaderType<'x>> ) -> Self

Set custom headers of a MIME part.

source

pub fn size(&self) -> usize

Returns the part’s size

source

pub fn add_part(&mut self, part: MimePart<'x>)

Add a body part to a multipart/* MIME part.

source

pub fn write_part(self, output: impl Write) -> Result<usize>

Write the MIME part to a writer.

Trait Implementations§

source§

impl<'x> Clone for MimePart<'x>

source§

fn clone(&self) -> MimePart<'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 MimePart<'x>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'x> RefUnwindSafe for MimePart<'x>

§

impl<'x> Send for MimePart<'x>

§

impl<'x> Sync for MimePart<'x>

§

impl<'x> Unpin for MimePart<'x>

§

impl<'x> UnwindSafe for MimePart<'x>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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.