Struct mailparsing::MimePart
source · pub struct MimePart<'a> { /* private fields */ }
Implementations§
source§impl<'a> MimePart<'a>
impl<'a> MimePart<'a>
sourcepub fn parse<S>(bytes: S) -> Result<Self>where
S: IntoSharedString<'a>,
pub fn parse<S>(bytes: S) -> Result<Self>where
S: IntoSharedString<'a>,
Parse some data into a tree of MimeParts
pub fn conformance(&self) -> MessageConformance
sourcepub fn child_parts(&self) -> &[Self]
pub fn child_parts(&self) -> &[Self]
Obtain a reference to the child parts
sourcepub fn child_parts_mut(&mut self) -> &mut Vec<Self>
pub fn child_parts_mut(&mut self) -> &mut Vec<Self>
Obtain a mutable reference to the child parts
sourcepub fn headers_mut<'b>(&'b mut self) -> &'b mut HeaderMap<'a>
pub fn headers_mut<'b>(&'b mut self) -> &'b mut HeaderMap<'a>
Obtain a mutable reference to the headers
sourcepub fn raw_body(&self) -> SharedString<'_>
pub fn raw_body(&self) -> SharedString<'_>
Get the raw, transfer-encoded body
sourcepub fn body(&self) -> Result<DecodedBody<'_>>
pub fn body(&self) -> Result<DecodedBody<'_>>
Decode transfer decoding and return the body
sourcepub fn rebuild(&self) -> Result<Self>
pub fn rebuild(&self) -> Result<Self>
Re-constitute the message. Each element will be parsed out, and the parsed form used to build a new message. This has the side effect of “fixing” non-conforming elements, but may come at the cost of “losing” the non-sensical or otherwise out of spec elements in the rebuilt message
sourcepub fn write_message<W: Write>(&self, out: &mut W) -> Result<()>
pub fn write_message<W: Write>(&self, out: &mut W) -> Result<()>
Write the message content to the provided output stream
sourcepub fn to_message_string(&self) -> String
pub fn to_message_string(&self) -> String
Convenience method wrapping write_message that returns the formatted message as a standalone string
pub fn replace_text_body(&mut self, content_type: &str, content: &str)
sourcepub fn new_text(content_type: &str, content: &str) -> Self
pub fn new_text(content_type: &str, content: &str) -> Self
Constructs a new part with textual utf8 content. quoted-printable transfer encoding will be applied, unless it is smaller to represent the text in base64
pub fn new_text_plain(content: &str) -> Self
pub fn new_html(content: &str) -> Self
pub fn new_multipart( content_type: &str, parts: Vec<Self>, boundary: Option<&str>, ) -> Self
pub fn new_binary( content_type: &str, content: &[u8], options: Option<&AttachmentOptions>, ) -> Self
sourcepub fn simplified_structure(&'a self) -> Result<SimplifiedStructure<'a>>
pub fn simplified_structure(&'a self) -> Result<SimplifiedStructure<'a>>
Returns a SimplifiedStructure representation of the mime tree, with the (probable) primary text/plain and text/html parts pulled out, and the remaining parts recorded as a flat attachments array
sourcepub fn resolve_ptr(&self, ptr: PartPointer) -> Option<&Self>
pub fn resolve_ptr(&self, ptr: PartPointer) -> Option<&Self>
Resolve a PartPointer to the corresponding MimePart
sourcepub fn resolve_ptr_mut(&mut self, ptr: PartPointer) -> Option<&mut Self>
pub fn resolve_ptr_mut(&mut self, ptr: PartPointer) -> Option<&mut Self>
Resolve a PartPointer to the corresponding MimePart, for mutable access
sourcepub fn simplified_structure_pointers(
&self,
) -> Result<SimplifiedStructurePointers>
pub fn simplified_structure_pointers( &self, ) -> Result<SimplifiedStructurePointers>
Returns a set of PartPointers that locate the (probable) primary text/plain and text/html parts, and the remaining parts recorded as a flat attachments array. The resulting PartPointers can be resolved to their actual instances for both immutable and mutable operations via resolve_ptr and resolve_ptr_mut.
Trait Implementations§
impl<'a> StructuralPartialEq for MimePart<'a>
Auto Trait Implementations§
impl<'a> Freeze for MimePart<'a>
impl<'a> RefUnwindSafe for MimePart<'a>
impl<'a> Send for MimePart<'a>
impl<'a> Sync for MimePart<'a>
impl<'a> Unpin for MimePart<'a>
impl<'a> UnwindSafe for MimePart<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)