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
Sourcepub fn to_owned(&self) -> MimePart<'static>
pub fn to_owned(&self) -> MimePart<'static>
Obtain a version of self that has a static lifetime
Sourcepub fn deep_conformance_check(&self) -> MessageConformance
pub fn deep_conformance_check(&self) -> MessageConformance
Recursively performs deeper conformance checks on the message. At this time that includes attempting to decode any text parts into UTF-8 to see if they are correctly annotated, but it may include more checks in the future. The results of the deep checks are combined with any conformance issues detected during parsing, and returned.
Sourcepub fn conformance(&self) -> MessageConformance
pub fn conformance(&self) -> MessageConformance
Returns the conformance flags determined during parsing
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
pub fn rfc2045_info(&self) -> Rfc2045Info
Sourcepub fn body(&self) -> Result<DecodedBody<'_>>
pub fn body(&self) -> Result<DecodedBody<'_>>
Decode transfer decoding and return the body
Sourcepub fn rebuild(&self, settings: Option<&CheckFixSettings>) -> Result<Self>
pub fn rebuild(&self, settings: Option<&CheckFixSettings>) -> 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, ) -> Result<()>
pub fn replace_binary_body( &mut self, content_type: &str, content: &[u8], ) -> Result<()>
pub fn new_no_transfer_encoding( content_type: &str, bytes: &[u8], ) -> Result<Self>
Sourcepub fn new_text(content_type: &str, content: &str) -> Result<Self>
pub fn new_text(content_type: &str, content: &str) -> Result<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) -> Result<Self>
pub fn new_html(content: &str) -> Result<Self>
pub fn new_multipart( content_type: &str, parts: Vec<Self>, boundary: Option<&str>, ) -> Result<Self>
pub fn new_binary( content_type: &str, content: &[u8], options: Option<&AttachmentOptions>, ) -> Result<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.