Struct melib::email::attachments::AttachmentBuilder
source · pub struct AttachmentBuilder {
pub content_type: ContentType,
pub content_transfer_encoding: ContentTransferEncoding,
pub content_disposition: ContentDisposition,
pub raw: Vec<u8>,
pub body: StrBuilder,
}
Expand description
A struct analogous to Attachment
which can have incomplete and partial
content before being turned into an Attachment
with
AttachmentBuilder::build
.
Fields§
§content_type: ContentType
§content_transfer_encoding: ContentTransferEncoding
§content_disposition: ContentDisposition
§raw: Vec<u8>
§body: StrBuilder
Implementations§
source§impl AttachmentBuilder
impl AttachmentBuilder
pub fn new(content: &[u8]) -> Self
pub fn new_plaintext(content: Vec<u8>) -> Self
pub fn raw(&self) -> &[u8] ⓘ
pub fn body(&self) -> &[u8] ⓘ
pub fn set_raw(&mut self, raw: Vec<u8>) -> &mut Self
sourcepub fn set_body_to_raw(&mut self) -> &mut Self
pub fn set_body_to_raw(&mut self) -> &mut Self
Set body to the entire raw contents, use this if raw contains only data
and no headers If raw contains data and headers pass it through
AttachmentBuilder::new
.
pub fn set_content_type(&mut self, val: ContentType) -> &mut Self
pub fn content_type(&self) -> &ContentType
pub fn set_content_transfer_encoding( &mut self, val: ContentTransferEncoding, ) -> &mut Self
pub fn set_content_disposition(&mut self, val: ContentDisposition) -> &mut Self
pub fn content_disposition(&self) -> &ContentDisposition
pub fn content_transfer_encoding(&self) -> &ContentTransferEncoding
pub fn set_content_type_from_bytes(&mut self, value: &[u8]) -> &mut Self
pub fn build(self) -> Attachment
pub fn parts(raw: &[u8], boundary: &[u8]) -> Vec<Attachment>
Trait Implementations§
source§impl Clone for AttachmentBuilder
impl Clone for AttachmentBuilder
source§fn clone(&self) -> AttachmentBuilder
fn clone(&self) -> AttachmentBuilder
Returns a copy of the value. Read more
1.0.0 · 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 AttachmentBuilder
impl Debug for AttachmentBuilder
source§impl Default for AttachmentBuilder
impl Default for AttachmentBuilder
source§fn default() -> AttachmentBuilder
fn default() -> AttachmentBuilder
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for AttachmentBuilder
impl<'de> Deserialize<'de> for AttachmentBuilder
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<Attachment> for AttachmentBuilder
impl From<Attachment> for AttachmentBuilder
source§fn from(val: Attachment) -> Self
fn from(val: Attachment) -> Self
Converts to this type from the input type.
source§impl From<AttachmentBuilder> for Attachment
impl From<AttachmentBuilder> for Attachment
source§fn from(val: AttachmentBuilder) -> Self
fn from(val: AttachmentBuilder) -> Self
Converts to this type from the input type.
source§impl PartialEq for AttachmentBuilder
impl PartialEq for AttachmentBuilder
source§fn eq(&self, other: &AttachmentBuilder) -> bool
fn eq(&self, other: &AttachmentBuilder) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for AttachmentBuilder
impl Serialize for AttachmentBuilder
impl Eq for AttachmentBuilder
impl StructuralPartialEq for AttachmentBuilder
Auto Trait Implementations§
impl Freeze for AttachmentBuilder
impl RefUnwindSafe for AttachmentBuilder
impl Send for AttachmentBuilder
impl Sync for AttachmentBuilder
impl Unpin for AttachmentBuilder
impl UnwindSafe for AttachmentBuilder
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.