Struct mail_parser::Message
source · [−]pub struct Message<'x> {
pub html_body: Vec<MessagePartId>,
pub text_body: Vec<MessagePartId>,
pub attachments: Vec<MessagePartId>,
pub parts: Vec<MessagePart<'x>>,
pub raw_message: Cow<'x, [u8]>,
}
Expand description
An RFC5322/RFC822 message.
Fields
html_body: Vec<MessagePartId>
text_body: Vec<MessagePartId>
attachments: Vec<MessagePartId>
parts: Vec<MessagePart<'x>>
raw_message: Cow<'x, [u8]>
Implementations
sourceimpl<'x> Message<'x>
impl<'x> Message<'x>
sourceimpl<'x> Message<'x>
impl<'x> Message<'x>
sourcepub fn get_root_part(&self) -> &MessagePart<'x>
pub fn get_root_part(&self) -> &MessagePart<'x>
Returns the root message part
sourcepub fn get_header(&self, header: &str) -> Option<&HeaderValue<'_>>
pub fn get_header(&self, header: &str) -> Option<&HeaderValue<'_>>
Returns a parsed header.
sourcepub fn remove_header(&mut self, header: &str) -> Option<HeaderValue<'_>>
pub fn remove_header(&mut self, header: &str) -> Option<HeaderValue<'_>>
Removed a parsed header and returns its value.
sourcepub fn remove_header_rfc(&mut self, header: RfcHeader) -> Option<HeaderValue<'_>>
pub fn remove_header_rfc(&mut self, header: RfcHeader) -> Option<HeaderValue<'_>>
Removed a parsed RFC heade and returns its value.
sourcepub fn get_header_raw(&self, header: &str) -> Option<&str>
pub fn get_header_raw(&self, header: &str) -> Option<&str>
Returns the raw header.
sourcepub fn get_headers(&self) -> &[Header<'_>]
pub fn get_headers(&self) -> &[Header<'_>]
Returns an iterator over the RFC headers of this message.
sourcepub fn get_header_values<'y: 'x>(
&'y self,
name: RfcHeader
) -> impl Iterator<Item = &'_ HeaderValue<'x>>
pub fn get_header_values<'y: 'x>(
&'y self,
name: RfcHeader
) -> impl Iterator<Item = &'_ HeaderValue<'x>>
Returns an iterator over the matching RFC headers of this message.
sourcepub fn get_headers_raw(&self) -> impl Iterator<Item = (&str, &str)>
pub fn get_headers_raw(&self) -> impl Iterator<Item = (&str, &str)>
Returns all headers in raw format
sourcepub fn get_bcc(&self) -> &HeaderValue<'_>
pub fn get_bcc(&self) -> &HeaderValue<'_>
Returns the BCC header field
sourcepub fn get_cc(&self) -> &HeaderValue<'_>
pub fn get_cc(&self) -> &HeaderValue<'_>
Returns the CC header field
sourcepub fn get_comments(&self) -> &HeaderValue<'_>
pub fn get_comments(&self) -> &HeaderValue<'_>
Returns all Comments header fields
sourcepub fn get_from(&self) -> &HeaderValue<'_>
pub fn get_from(&self) -> &HeaderValue<'_>
Returns the From header field
sourcepub fn get_in_reply_to(&self) -> &HeaderValue<'_>
pub fn get_in_reply_to(&self) -> &HeaderValue<'_>
Returns all In-Reply-To header fields
sourcepub fn get_keywords(&self) -> &HeaderValue<'_>
pub fn get_keywords(&self) -> &HeaderValue<'_>
Returns all Keywords header fields
sourcepub fn get_list_archive(&self) -> &HeaderValue<'_>
pub fn get_list_archive(&self) -> &HeaderValue<'_>
Returns the List-Archive header field
sourcepub fn get_list_help(&self) -> &HeaderValue<'_>
pub fn get_list_help(&self) -> &HeaderValue<'_>
Returns the List-Help header field
sourcepub fn get_list_id(&self) -> &HeaderValue<'_>
pub fn get_list_id(&self) -> &HeaderValue<'_>
Returns the List-ID header field
sourcepub fn get_list_owner(&self) -> &HeaderValue<'_>
pub fn get_list_owner(&self) -> &HeaderValue<'_>
Returns the List-Owner header field
sourcepub fn get_list_post(&self) -> &HeaderValue<'_>
pub fn get_list_post(&self) -> &HeaderValue<'_>
Returns the List-Post header field
sourcepub fn get_list_subscribe(&self) -> &HeaderValue<'_>
pub fn get_list_subscribe(&self) -> &HeaderValue<'_>
Returns the List-Subscribe header field
sourcepub fn get_list_unsubscribe(&self) -> &HeaderValue<'_>
pub fn get_list_unsubscribe(&self) -> &HeaderValue<'_>
Returns the List-Unsubscribe header field
sourcepub fn get_message_id(&self) -> Option<&str>
pub fn get_message_id(&self) -> Option<&str>
Returns the Message-ID header field
sourcepub fn get_mime_version(&self) -> &HeaderValue<'_>
pub fn get_mime_version(&self) -> &HeaderValue<'_>
Returns the MIME-Version header field
sourcepub fn get_received(&self) -> &HeaderValue<'_>
pub fn get_received(&self) -> &HeaderValue<'_>
Returns all Received header fields
sourcepub fn get_references(&self) -> &HeaderValue<'_>
pub fn get_references(&self) -> &HeaderValue<'_>
Returns all References header fields
sourcepub fn get_reply_to(&self) -> &HeaderValue<'_>
pub fn get_reply_to(&self) -> &HeaderValue<'_>
Returns the Reply-To header field
sourcepub fn get_resent_bcc(&self) -> &HeaderValue<'_>
pub fn get_resent_bcc(&self) -> &HeaderValue<'_>
Returns the Resent-BCC header field
sourcepub fn get_resent_cc(&self) -> &HeaderValue<'_>
pub fn get_resent_cc(&self) -> &HeaderValue<'_>
Returns the Resent-CC header field
sourcepub fn get_resent_date(&self) -> &HeaderValue<'_>
pub fn get_resent_date(&self) -> &HeaderValue<'_>
Returns all Resent-Date header fields
sourcepub fn get_resent_from(&self) -> &HeaderValue<'_>
pub fn get_resent_from(&self) -> &HeaderValue<'_>
Returns the Resent-From header field
sourcepub fn get_resent_message_id(&self) -> &HeaderValue<'_>
pub fn get_resent_message_id(&self) -> &HeaderValue<'_>
Returns all Resent-Message-ID header fields
sourcepub fn get_resent_sender(&self) -> &HeaderValue<'_>
pub fn get_resent_sender(&self) -> &HeaderValue<'_>
Returns the Sender header field
sourcepub fn get_resent_to(&self) -> &HeaderValue<'_>
pub fn get_resent_to(&self) -> &HeaderValue<'_>
Returns the Resent-To header field
sourcepub fn get_return_path(&self) -> &HeaderValue<'_>
pub fn get_return_path(&self) -> &HeaderValue<'_>
Returns all Return-Path header fields
sourcepub fn get_return_address(&self) -> Option<&str>
pub fn get_return_address(&self) -> Option<&str>
Returns the return address from either the Return-Path or From header fields
sourcepub fn get_sender(&self) -> &HeaderValue<'_>
pub fn get_sender(&self) -> &HeaderValue<'_>
Returns the Sender header field
sourcepub fn get_subject(&self) -> Option<&str>
pub fn get_subject(&self) -> Option<&str>
Returns the Subject header field
sourcepub fn get_thread_name(&self) -> Option<&str>
pub fn get_thread_name(&self) -> Option<&str>
Returns the message thread name or ‘base subject’ as defined in RFC 5957 - Internet Message Access Protocol - SORT and THREAD Extensions (Section 2.1)
sourcepub fn get_to(&self) -> &HeaderValue<'_>
pub fn get_to(&self) -> &HeaderValue<'_>
Returns the To header field
sourcepub fn get_body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>>
pub fn get_body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>>
Returns a preview of the message body
sourcepub fn get_html_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
pub fn get_html_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
Returns the transformed contents an inline HTML body part by position
sourcepub fn get_text_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
pub fn get_text_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
Returns the transformed contents an inline text body part by position
sourcepub fn get_part(&self, pos: usize) -> Option<&MessagePart<'_>>
pub fn get_part(&self, pos: usize) -> Option<&MessagePart<'_>>
Returns a message part by position
sourcepub fn get_html_part(&self, pos: usize) -> Option<&MessagePart<'_>>
pub fn get_html_part(&self, pos: usize) -> Option<&MessagePart<'_>>
Returns an inline HTML body part by position
sourcepub fn get_text_part(&self, pos: usize) -> Option<&MessagePart<'_>>
pub fn get_text_part(&self, pos: usize) -> Option<&MessagePart<'_>>
Returns an inline text body part by position
sourcepub fn get_attachment(&self, pos: usize) -> Option<&MessagePart<'x>>
pub fn get_attachment(&self, pos: usize) -> Option<&MessagePart<'x>>
Returns an attacment by position
sourcepub fn get_text_body_count(&self) -> usize
pub fn get_text_body_count(&self) -> usize
Returns the number of plain text body parts
sourcepub fn get_html_body_count(&self) -> usize
pub fn get_html_body_count(&self) -> usize
Returns the number of HTML body parts
sourcepub fn get_attachment_count(&self) -> usize
pub fn get_attachment_count(&self) -> usize
Returns the number of attachments
sourcepub fn get_text_bodies(&'x self) -> BodyPartIterator<'x>
pub fn get_text_bodies(&'x self) -> BodyPartIterator<'x>
Returns an Interator over the text body parts
sourcepub fn get_html_bodies(&'x self) -> BodyPartIterator<'x>
pub fn get_html_bodies(&'x self) -> BodyPartIterator<'x>
Returns an Interator over the HTML body parts
sourcepub fn get_attachments(&'x self) -> AttachmentIterator<'x>
pub fn get_attachments(&'x self) -> AttachmentIterator<'x>
Returns an Interator over the attachments
Trait Implementations
sourceimpl<'de: 'x, 'x> Deserialize<'de> for Message<'x>
impl<'de: 'x, 'x> Deserialize<'de> for Message<'x>
sourcefn 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
sourceimpl<'x> MimeHeaders<'x> for Message<'x>
impl<'x> MimeHeaders<'x> for Message<'x>
sourcefn get_content_description(&self) -> Option<&str>
fn get_content_description(&self) -> Option<&str>
Returns the Content-Description field
sourcefn get_content_disposition(&self) -> Option<&ContentType<'_>>
fn get_content_disposition(&self) -> Option<&ContentType<'_>>
Returns the Content-Disposition field
sourcefn get_content_id(&self) -> Option<&str>
fn get_content_id(&self) -> Option<&str>
Returns the Content-ID field
sourcefn get_content_transfer_encoding(&self) -> Option<&str>
fn get_content_transfer_encoding(&self) -> Option<&str>
Returns the Content-Encoding field
sourcefn get_content_type(&self) -> Option<&ContentType<'_>>
fn get_content_type(&self) -> Option<&ContentType<'_>>
Returns the Content-Type field
sourcefn get_content_language(&self) -> &HeaderValue<'_>
fn get_content_language(&self) -> &HeaderValue<'_>
Returns the Content-Language field
sourcefn get_content_location(&self) -> Option<&str>
fn get_content_location(&self) -> Option<&str>
Returns the Content-Location field
sourcefn get_attachment_name(&self) -> Option<&str>
fn get_attachment_name(&self) -> Option<&str>
Returns the attachment name, if any.
sourceimpl<'x> PartialEq<Message<'x>> for Message<'x>
impl<'x> PartialEq<Message<'x>> for Message<'x>
impl<'x> StructuralPartialEq for Message<'x>
Auto Trait Implementations
impl<'x> RefUnwindSafe for Message<'x>
impl<'x> Send for Message<'x>
impl<'x> Sync for Message<'x>
impl<'x> Unpin for Message<'x>
impl<'x> UnwindSafe for Message<'x>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more