Struct mpot::Envelope

pub struct Envelope {
Show 16 fields pub hash: EnvelopeHash, pub date: String, pub timestamp: u64, pub from: SmallVec<[Address; 1]>, pub to: SmallVec<[Address; 1]>, pub cc: SmallVec<[Address; 1]>, pub bcc: Vec<Address, Global>, pub subject: Option<String>, pub message_id: MessageID, pub in_reply_to: Option<MessageID>, pub references: Option<References>, pub other_headers: HeaderMap, pub thread: ThreadNodeHash, pub flags: Flag, pub has_attachments: bool, pub tags: SmallVec<[TagHash; 8]>,
}
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§

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

Implementations§

§

impl Envelope

pub fn new(hash: EnvelopeHash) -> Envelope

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

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

pub fn hash(&self) -> EnvelopeHash

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

pub fn date(&self) -> u64

pub fn datetime(&self) -> u64

pub fn date_as_str(&self) -> &str

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

pub fn field_bcc_to_string(&self) -> String

pub fn field_cc_to_string(&self) -> String

pub fn field_from_to_string(&self) -> String

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

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

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

pub fn field_to_to_string(&self) -> String

pub fn field_references_to_string(&self) -> String

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

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

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

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

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

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

pub fn message_id(&self) -> &MessageID

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

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

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

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

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

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

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

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

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

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

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

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

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

pub fn other_headers(&self) -> &HeaderMap

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

pub fn thread(&self) -> ThreadNodeHash

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

pub fn set_datetime(&mut self, new_val: u64) -> &mut Envelope

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

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

pub fn flags(&self) -> Flag

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

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

pub fn is_seen(&self) -> bool

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

pub fn has_attachments(&self) -> bool

pub fn tags(&self) -> &SmallVec<[TagHash; 8]>

pub fn tags_mut(&mut self) -> &mut SmallVec<[TagHash; 8]>

Trait Implementations§

§

impl Clone for Envelope

§

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
§

impl Debug for Envelope

§

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

Formats the value using the given formatter. Read more
§

impl Default for Envelope

§

fn default() -> Envelope

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

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

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Envelope, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Ord for Envelope

§

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

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

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

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

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

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

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

Restrict a value to a certain interval. Read more
§

impl PartialEq<Envelope> for Envelope

§

fn eq(&self, other: &Envelope) -> 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.
§

impl PartialOrd<Envelope> for Envelope

§

fn partial_cmp(&self, other: &Envelope) -> 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
§

impl QueryTrait for Envelope

§

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

§

impl Serialize for Envelope

§

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

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

impl Eq for Envelope

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere 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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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