pub struct Attachment {
pub filename: String,
pub content: Vec<u8>,
pub content_type: Option<String>,
pub content_id: Option<String>,
}Expand description
An inline attachment. content is raw bytes; it is base64-encoded on the wire.
Fields§
§filename: String§content: Vec<u8>§content_type: Option<String>§content_id: Option<String>Implementations§
Source§impl Attachment
impl Attachment
Sourcepub fn new(filename: impl Into<String>, content: impl Into<Vec<u8>>) -> Self
pub fn new(filename: impl Into<String>, content: impl Into<Vec<u8>>) -> Self
Create an attachment from raw bytes (e.g. std::fs::read("report.pdf")?).
pub fn content_type(self, content_type: impl Into<String>) -> Self
Sourcepub fn content_id(self, content_id: impl Into<String>) -> Self
pub fn content_id(self, content_id: impl Into<String>) -> Self
Set a Content-ID, marking the attachment inline (referenced via cid:).
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Attachment
impl Debug for Attachment
Auto Trait Implementations§
impl Freeze for Attachment
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnsafeUnpin for Attachment
impl UnwindSafe for Attachment
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