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>
impl<'x> MimePart<'x>
sourcepub fn new(
content_type: impl Into<ContentType<'x>>,
contents: impl Into<BodyPart<'x>>
) -> Self
pub fn new( content_type: impl Into<ContentType<'x>>, contents: impl Into<BodyPart<'x>> ) -> Self
Create a new 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more