pub struct MessageRef<'m> { /* private fields */ }Expand description
A message inside a Message: the root message, or a message nested in
a message/rfc822 (or message/global) part. Each message has its own
root part, header fields and body lists.
Implementations§
Source§impl<'m> MessageRef<'m>
impl<'m> MessageRef<'m>
Sourcepub fn id(&self) -> MessageId
pub fn id(&self) -> MessageId
The id of this message: 0 for the root, then nested messages in document order.
Sourcepub fn root_part(&self) -> MessagePart<'m>
pub fn root_part(&self) -> MessagePart<'m>
The root part: the header block of this message and its body.
Sourcepub fn container(&self) -> Option<MessagePart<'m>>
pub fn container(&self) -> Option<MessagePart<'m>>
The message/rfc822 part holding this message; None for the root
message.
Sourcepub fn source_bytes(&self) -> &'m [u8] ⓘ
pub fn source_bytes(&self) -> &'m [u8] ⓘ
The bytes of the buffer this message’s offsets refer to.
Sourcepub fn headers(&self) -> Headers<'m>
pub fn headers(&self) -> Headers<'m>
The header fields of this message: those of its root part.
Sourcepub fn parts(&self) -> impl Iterator<Item = MessagePart<'m>> + use<'m>
pub fn parts(&self) -> impl Iterator<Item = MessagePart<'m>> + use<'m>
The parts of this message (nested messages excluded), in document order.
Sourcepub fn text_body(
&self,
) -> impl ExactSizeIterator<Item = MessagePart<'m>> + use<'m>
pub fn text_body( &self, ) -> impl ExactSizeIterator<Item = MessagePart<'m>> + use<'m>
The parts that make up the text body (RFC 8621 textBody): text
parts, HTML parts standing in for a missing text version, and inline
media, in reading order. MessageRef::text_bodies gives them as
text.
Sourcepub fn html_body(
&self,
) -> impl ExactSizeIterator<Item = MessagePart<'m>> + use<'m>
pub fn html_body( &self, ) -> impl ExactSizeIterator<Item = MessagePart<'m>> + use<'m>
The parts that make up the HTML body (RFC 8621 htmlBody): HTML
parts, text parts standing in for a missing HTML version, and inline
media, in reading order. MessageRef::html_bodies gives them as
HTML.
Sourcepub fn attachments(
&self,
) -> impl ExactSizeIterator<Item = MessagePart<'m>> + use<'m>
pub fn attachments( &self, ) -> impl ExactSizeIterator<Item = MessagePart<'m>> + use<'m>
The attachments (RFC 8621 attachments): the leaf parts, nested
messages included, that are not shown as part of the body, plus inline
media shown in only one of the two bodies.
Sourcepub fn has_attachments(&self) -> bool
pub fn has_attachments(&self) -> bool
Whether a client should offer this message as having attachments:
RFC 8621 hasAttachment, true when MessageRef::attachments holds
a part without Content-Disposition: inline. Images referenced by
cid: count unless they are marked inline; the RFC’s optional
exception for embedded images is not applied.
Sourcepub fn other_parts(&self) -> impl Iterator<Item = MessagePart<'m>> + use<'m>
pub fn other_parts(&self) -> impl Iterator<Item = MessagePart<'m>> + use<'m>
The parts of this message that are in no list (issue #107):
containers excluded, nested messages excluded. For a message from
crate::MessageParser::parse_headers this is the root part.
Sourcepub fn text_bodies(&self) -> impl Iterator<Item = Cow<'m, str>> + use<'m>
pub fn text_bodies(&self) -> impl Iterator<Item = Cow<'m, str>> + use<'m>
The text body as text: HTML parts converted, non-text parts skipped.
Sourcepub fn html_bodies(&self) -> impl Iterator<Item = Cow<'m, str>> + use<'m>
pub fn html_bodies(&self) -> impl Iterator<Item = Cow<'m, str>> + use<'m>
The HTML body as HTML: text parts converted, non-text parts skipped.
Sourcepub fn body_text(&self, index: usize) -> Option<Cow<'m, str>>
pub fn body_text(&self, index: usize) -> Option<Cow<'m, str>>
The text of the index-th part of the text body.
Sourcepub fn body_html(&self, index: usize) -> Option<Cow<'m, str>>
pub fn body_html(&self, index: usize) -> Option<Cow<'m, str>>
The HTML of the index-th part of the HTML body.
Sourcepub fn body_preview(&self, max_len: usize) -> Option<Cow<'m, str>>
pub fn body_preview(&self, max_len: usize) -> Option<Cow<'m, str>>
A preview of at most max_len bytes of the first text body, else of
the first HTML body, without carriage returns; see preview_text.
Sourcepub fn content_type(&self) -> Option<ContentType<'m>>
pub fn content_type(&self) -> Option<ContentType<'m>>
The Content-Type of the root part.
Sourcepub fn content_disposition(&self) -> Option<ContentType<'m>>
pub fn content_disposition(&self) -> Option<ContentType<'m>>
The Content-Disposition of the root part.
Sourcepub fn attachment_name(&self) -> Option<&'m str>
pub fn attachment_name(&self) -> Option<&'m str>
The attachment name of the root part; see
MessagePart::attachment_name.
Sourcepub fn is_content_type(&self, type_: &str, subtype: &str) -> bool
pub fn is_content_type(&self, type_: &str, subtype: &str) -> bool
Whether the Content-Type of the root part is type_/subtype (ASCII
case-insensitive).
Sourcepub fn mime_version(&self) -> Option<&'m str>
pub fn mime_version(&self) -> Option<&'m str>
The MIME-Version field, as written.
Sourcepub fn thread_name(&self) -> Option<&'m str>
pub fn thread_name(&self) -> Option<&'m str>
The subject with reply and forward markers removed; see
crate::thread_name.
Sourcepub fn from(&self) -> Option<AddressList<'m>>
pub fn from(&self) -> Option<AddressList<'m>>
The From field.
Sourcepub fn to(&self) -> Option<AddressList<'m>>
pub fn to(&self) -> Option<AddressList<'m>>
The To field.
Sourcepub fn cc(&self) -> Option<AddressList<'m>>
pub fn cc(&self) -> Option<AddressList<'m>>
The Cc field.
Sourcepub fn bcc(&self) -> Option<AddressList<'m>>
pub fn bcc(&self) -> Option<AddressList<'m>>
The Bcc field.
Sourcepub fn reply_to(&self) -> Option<AddressList<'m>>
pub fn reply_to(&self) -> Option<AddressList<'m>>
The Reply-To field.
Sourcepub fn sender(&self) -> Option<AddressList<'m>>
pub fn sender(&self) -> Option<AddressList<'m>>
The Sender field.
Sourcepub fn all_from(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
pub fn all_from(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
Every From field, in document order.
Sourcepub fn all_to(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
pub fn all_to(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
Every To field, in document order.
Sourcepub fn all_cc(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
pub fn all_cc(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
Every Cc field, in document order.
Sourcepub fn all_bcc(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
pub fn all_bcc(&self) -> impl Iterator<Item = AddressList<'m>> + use<'m>
Every Bcc field, in document order.
Sourcepub fn resent_to(&self) -> Option<AddressList<'m>>
pub fn resent_to(&self) -> Option<AddressList<'m>>
The Resent-To field.
Sourcepub fn resent_from(&self) -> Option<AddressList<'m>>
pub fn resent_from(&self) -> Option<AddressList<'m>>
The Resent-From field.
Sourcepub fn resent_cc(&self) -> Option<AddressList<'m>>
pub fn resent_cc(&self) -> Option<AddressList<'m>>
The Resent-Cc field.
Sourcepub fn resent_bcc(&self) -> Option<AddressList<'m>>
pub fn resent_bcc(&self) -> Option<AddressList<'m>>
The Resent-Bcc field.
Sourcepub fn resent_sender(&self) -> Option<AddressList<'m>>
pub fn resent_sender(&self) -> Option<AddressList<'m>>
The Resent-Sender field.
Sourcepub fn list_archive(&self) -> Option<AddressList<'m>>
pub fn list_archive(&self) -> Option<AddressList<'m>>
The List-Archive field; see Headers::list_archive.
Sourcepub fn list_help(&self) -> Option<AddressList<'m>>
pub fn list_help(&self) -> Option<AddressList<'m>>
The List-Help field; see Headers::list_help.
Sourcepub fn list_id(&self) -> Option<AddressList<'m>>
pub fn list_id(&self) -> Option<AddressList<'m>>
The List-ID field; see Headers::list_id.
Sourcepub fn list_owner(&self) -> Option<AddressList<'m>>
pub fn list_owner(&self) -> Option<AddressList<'m>>
The List-Owner field; see Headers::list_owner.
Sourcepub fn list_post(&self) -> Option<AddressList<'m>>
pub fn list_post(&self) -> Option<AddressList<'m>>
The List-Post field; see Headers::list_post.
Sourcepub fn list_subscribe(&self) -> Option<AddressList<'m>>
pub fn list_subscribe(&self) -> Option<AddressList<'m>>
The List-Subscribe field; see Headers::list_subscribe.
Sourcepub fn list_unsubscribe(&self) -> Option<AddressList<'m>>
pub fn list_unsubscribe(&self) -> Option<AddressList<'m>>
The List-Unsubscribe field; see Headers::list_unsubscribe.
Sourcepub fn resent_date(&self) -> Option<DateTime>
pub fn resent_date(&self) -> Option<DateTime>
The Resent-Date field.
Sourcepub fn message_id(&self) -> Option<&'m str>
pub fn message_id(&self) -> Option<&'m str>
The last identifier of the Message-ID field, without angle brackets.
Sourcepub fn in_reply_to(&self) -> Option<TextList<'m>>
pub fn in_reply_to(&self) -> Option<TextList<'m>>
The identifiers of the In-Reply-To field.
Sourcepub fn references(&self) -> Option<TextList<'m>>
pub fn references(&self) -> Option<TextList<'m>>
The identifiers of the References field.
Sourcepub fn resent_message_id(&self) -> Option<TextList<'m>>
pub fn resent_message_id(&self) -> Option<TextList<'m>>
The identifiers of the Resent-Message-ID field.
Sourcepub fn return_path(&self) -> Option<TextList<'m>>
pub fn return_path(&self) -> Option<TextList<'m>>
The Return-Path field; see Headers::return_path.
Sourcepub fn return_address(&self) -> Option<&'m str>
pub fn return_address(&self) -> Option<&'m str>
The last address of Return-Path, or else the first address of From.
Sourcepub fn all_received(&self) -> impl Iterator<Item = Received<'m>> + use<'m>
pub fn all_received(&self) -> impl Iterator<Item = Received<'m>> + use<'m>
Every Received field, in document order (newest hop first).