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
sourceimpl<'x> MimePart<'x>
impl<'x> MimePart<'x>
sourcepub fn new(content_type: ContentType<'x>, contents: BodyPart<'x>) -> Self
pub fn new(content_type: ContentType<'x>, contents: BodyPart<'x>) -> Self
Create a custom MIME part.
sourcepub fn new_multipart(
content_type: impl Into<Cow<'x, str>>,
contents: Vec<MimePart<'x>>
) -> Self
pub fn new_multipart(
content_type: impl Into<Cow<'x, str>>,
contents: Vec<MimePart<'x>>
) -> Self
Create a new multipart/* MIME part.
sourcepub fn new_text_other(
content_type: impl Into<Cow<'x, str>>,
contents: impl Into<Cow<'x, str>>
) -> Self
pub fn new_text_other(
content_type: impl Into<Cow<'x, str>>,
contents: impl Into<Cow<'x, str>>
) -> Self
Create a new text/* MIME part.
sourcepub fn new_binary(
c_type: impl Into<Cow<'x, str>>,
contents: impl Into<Cow<'x, [u8]>>
) -> Self
pub fn new_binary(
c_type: impl Into<Cow<'x, str>>,
contents: impl Into<Cow<'x, [u8]>>
) -> Self
Create a new binary MIME part.
sourcepub fn attachment(self, filename: impl Into<Cow<'x, str>>) -> Self
pub fn attachment(self, filename: impl Into<Cow<'x, str>>) -> Self
Set the attachment filename of a MIME part.
sourcepub fn language(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn language(self, value: impl Into<Cow<'x, str>>) -> Self
Set the Content-Language header of a MIME part.
sourcepub fn cid(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn cid(self, value: impl Into<Cow<'x, str>>) -> Self
Set the Content-ID header of a MIME part.
sourcepub fn location(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn location(self, value: impl Into<Cow<'x, str>>) -> Self
Set the Content-Location header of a MIME part.
sourcepub fn header(
self,
header: impl Into<Cow<'x, str>>,
value: impl Into<HeaderType<'x>>
) -> Self
pub fn header(
self,
header: impl Into<Cow<'x, str>>,
value: impl Into<HeaderType<'x>>
) -> Self
Set custom headers of a MIME part.
sourcepub fn write_part(self, output: impl Write) -> Result<usize>
pub fn write_part(self, output: impl Write) -> Result<usize>
Write the MIME part to a writer.
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more