Struct melib::email::Envelope

source ·
pub struct Envelope {
Show 16 fields pub date: String, pub subject: Option<String>, pub from: SmallVec<[Address; 1]>, pub to: SmallVec<[Address; 1]>, pub cc: SmallVec<[Address; 1]>, pub bcc: Vec<Address>, pub in_reply_to: Option<MessageID>, pub message_id: MessageID, pub hash: EnvelopeHash, pub timestamp: UnixTimestamp, pub references: Option<References>, pub other_headers: HeaderMap, pub thread: ThreadNodeHash, pub flags: Flag, pub has_attachments: bool, pub tags: IndexSet<TagHash>,
}
Expand description

Envelope represents all the header and structure data of an email we need to know.

Attachments (the email’s body) is parsed on demand with body method.

To access the email attachments, you need to parse them from the raw email bytes into an Attachment object.

Fields§

§date: String§subject: Option<String>§from: SmallVec<[Address; 1]>§to: SmallVec<[Address; 1]>§cc: SmallVec<[Address; 1]>§bcc: Vec<Address>§in_reply_to: Option<MessageID>§message_id: MessageID§hash: EnvelopeHash§timestamp: UnixTimestamp§references: Option<References>§other_headers: HeaderMap§thread: ThreadNodeHash§flags: Flag§has_attachments: bool§tags: IndexSet<TagHash>

Implementations§

source§

impl Envelope

source

pub fn new(hash: EnvelopeHash) -> Self

source

pub fn set_hash(&mut self, new_hash: EnvelopeHash) -> &mut Self

source

pub fn from_bytes(bytes: &[u8], flags: Option<Flag>) -> Result<Self>

source

pub fn hash(&self) -> EnvelopeHash

source

pub fn populate_headers(&mut self, bytes: &[u8]) -> Result<()>

source

pub fn date(&self) -> UnixTimestamp

source

pub fn datetime(&self) -> UnixTimestamp

source

pub fn date_as_str(&self) -> &str

source

pub fn from(&self) -> &[Address]

source

pub fn field_bcc_to_string(&self) -> String

source

pub fn field_cc_to_string(&self) -> String

source

pub fn field_from_to_string(&self) -> String

source

pub fn to(&self) -> &[Address]

source

pub fn cc(&self) -> &[Address]

source

pub fn bcc(&self) -> &[Address]

source

pub fn field_to_to_string(&self) -> String

source

pub fn field_references_to_string(&self) -> String

source

pub fn body_bytes(&self, bytes: &[u8]) -> Attachment

source

pub fn headers<'a>(&self, bytes: &'a [u8]) -> Result<Vec<(HeaderName, &'a str)>>

source

pub fn subject(&self) -> Cow<'_, str>

source

pub fn in_reply_to(&self) -> Option<&MessageID>

source

pub fn in_reply_to_display(&self) -> Option<Cow<'_, str>>

source

pub fn in_reply_to_raw(&self) -> Option<Cow<'_, str>>

source

pub fn message_id(&self) -> &MessageID

source

pub fn message_id_display(&self) -> Cow<'_, str>

source

pub fn message_id_raw(&self) -> Cow<'_, str>

source

pub fn set_date(&mut self, new_val: &[u8]) -> &mut Self

source

pub fn set_bcc(&mut self, new_val: Vec<Address>) -> &mut Self

source

pub fn set_cc(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Self

source

pub fn set_from(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Self

source

pub fn set_to(&mut self, new_val: SmallVec<[Address; 1]>) -> &mut Self

source

pub fn set_in_reply_to(&mut self, new_val: &[u8]) -> &mut Self

source

pub fn set_subject(&mut self, new_val: Vec<u8>) -> &mut Self

source

pub fn set_message_id(&mut self, new_val: &[u8]) -> &mut Self

source

pub fn push_references(&mut self, new_ref: MessageID)

source

pub fn set_references(&mut self, new_val: &[u8]) -> &mut Self

source

pub fn references(&self) -> SmallVec<[&MessageID; 8]>

source

pub fn other_headers(&self) -> &HeaderMap

source

pub fn other_headers_mut(&mut self) -> &mut HeaderMap

source

pub fn thread(&self) -> ThreadNodeHash

source

pub fn set_thread(&mut self, new_val: ThreadNodeHash) -> &mut Self

source

pub fn set_datetime(&mut self, new_val: UnixTimestamp) -> &mut Self

source

pub fn set_flag(&mut self, f: Flag, value: bool) -> &mut Self

source

pub fn set_flags(&mut self, f: Flag) -> &mut Self

source

pub fn flags(&self) -> Flag

source

pub fn set_seen(&mut self) -> &mut Self

source

pub fn set_unseen(&mut self) -> &mut Self

source

pub fn is_seen(&self) -> bool

source

pub fn set_has_attachments(&mut self, new_val: bool) -> &mut Self

source

pub fn has_attachments(&self) -> bool

source

pub fn tags(&self) -> &IndexSet<TagHash>

source

pub fn tags_mut(&mut self) -> &mut IndexSet<TagHash>

Trait Implementations§

source§

impl Clone for Envelope

source§

fn clone(&self) -> Envelope

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Envelope

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Envelope

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Envelope

source§

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 Ord for Envelope

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Envelope

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Envelope

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl QueryTrait for Envelope

source§

fn is_match(&self, query: &Query) -> bool

source§

impl Serialize for Envelope

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Envelope

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,