Struct Email

Source
pub struct Email { /* private fields */ }

Implementations§

Source§

impl Email

Source

pub fn new<F, D>(from: F, date: D) -> Result<Email, ParseError>
where From: TryFrom<F, Error = ParseError>, OrigDate: TryFrom<D, Error = ParseError>,

Create a new email structure. The From address and Date fields are required in all valid emails, thus you must pass these in.

Source

pub fn set_date<D>(&mut self, date: D) -> Result<(), ParseError>
where OrigDate: TryFrom<D, Error = ParseError>,

Replace the Date field in the email

Source

pub fn get_date(&self) -> OrigDate

Fetch the Date field from the email

Source

pub fn set_from<F>(&mut self, from: F) -> Result<(), ParseError>
where From: TryFrom<F, Error = ParseError>,

Replace the From field in the email

Source

pub fn get_from(&self) -> From

Fetch the From field from the email

Source

pub fn set_sender<S>(&mut self, sender: S) -> Result<(), ParseError>
where Sender: TryFrom<S, Error = ParseError>,

Set or replace the Sender field in the email

Source

pub fn get_sender(&self) -> Option<Sender>

Fetch the Sender field from the email

Source

pub fn clear_sender(&mut self)

Remove the Sender field from the email

Source

pub fn set_reply_to<R>(&mut self, reply_to: R) -> Result<(), ParseError>
where ReplyTo: TryFrom<R, Error = ParseError>,

Set or replace the Reply-To field in the email

Source

pub fn get_reply_to(&self) -> Option<ReplyTo>

Fetch the Reply-To field from the email

Source

pub fn clear_reply_to(&mut self)

Remove the Reply-To field from the email

Source

pub fn set_to<T>(&mut self, to: T) -> Result<(), ParseError>
where To: TryFrom<T, Error = ParseError>,

Set or replace the To field in the email

Source

pub fn get_to(&self) -> Option<To>

Fetch the To field from the email

Source

pub fn clear_to(&mut self)

Remove the To field from the email

Source

pub fn set_cc<C>(&mut self, cc: C) -> Result<(), ParseError>
where Cc: TryFrom<C, Error = ParseError>,

Set or replace the Cc field in the email

Source

pub fn get_cc(&self) -> Option<Cc>

Fetch the Cc field from the email

Source

pub fn clear_cc(&mut self)

Remove the Cc field from the email

Source

pub fn set_bcc<B>(&mut self, bcc: B) -> Result<(), ParseError>
where Bcc: TryFrom<B, Error = ParseError>,

Set or replace the Bcc field in the email

Source

pub fn get_bcc(&self) -> Option<Bcc>

Fetch the Bcc field from the email

Source

pub fn clear_bcc(&mut self)

Remove the Bcc field from the email

Source

pub fn set_message_id<M>(&mut self, message_id: M) -> Result<(), ParseError>
where MessageId: TryFrom<M, Error = ParseError>,

Set or replace the Message-ID field in the email

Source

pub fn get_message_id(&self) -> Option<MessageId>

Fetch the Message-ID field from the email

Source

pub fn clear_message_id(&mut self)

Remove the Message-ID field from the email

Source

pub fn set_in_reply_to<I>(&mut self, in_reply_to: I) -> Result<(), ParseError>
where InReplyTo: TryFrom<I, Error = ParseError>,

Set or replace the In-Reply-To field in the email

Source

pub fn get_in_reply_to(&self) -> Option<InReplyTo>

Fetch the In-Reply-To field from the email

Source

pub fn clear_in_reply_to(&mut self)

Remove the In-Reply-To field from the email

Source

pub fn set_references<R>(&mut self, references: R) -> Result<(), ParseError>
where References: TryFrom<R, Error = ParseError>,

Set or replace the References field in the email

Source

pub fn get_references(&self) -> Option<References>

Fetch the References field from the email

Source

pub fn clear_references(&mut self)

Remove the References field from the email

Source

pub fn set_subject<S>(&mut self, subject: S) -> Result<(), ParseError>
where Subject: TryFrom<S, Error = ParseError>,

Set or replace the Subject field in the email

Source

pub fn get_subject(&self) -> Option<Subject>

Fetch the Subject field from the email

Source

pub fn clear_subject(&mut self)

Remove the Subject field from the email

Source

pub fn add_comments<C>(&mut self, comments: C) -> Result<(), ParseError>
where Comments: TryFrom<C, Error = ParseError>,

Add a Comments field in the email. This may be in addition to existing Comments fields.

Source

pub fn get_comments(&self) -> Vec<Comments>

Fetch all Comments fields from the email

Source

pub fn clear_comments(&mut self)

Remove all Comments fields from the email

Source

pub fn add_keywords<K>(&mut self, keywords: K) -> Result<(), ParseError>
where Keywords: TryFrom<K, Error = ParseError>,

Add a Keywords field in the email. This may be in addition to existing Keywords fields.

Source

pub fn get_keywords(&self) -> Vec<Keywords>

Fetch all Keywords fields from the email

Source

pub fn clear_keywords(&mut self)

Remove all Keywords fields from the email

Source

pub fn add_optional_field<O>( &mut self, optional_field: O, ) -> Result<(), ParseError>
where OptionalField: TryFrom<O, Error = ParseError>,

Add an optional field to the email. This may be in addition to existing optional fields.

Source

pub fn get_optional_fields(&self) -> Vec<OptionalField>

Fetch all optional fields from the email

Source

pub fn clear_optional_fields(&mut self)

Clear all optional fields from the email

Source

pub fn set_body<B>(&mut self, body: B) -> Result<(), ParseError>
where Body: TryFrom<B, Error = ParseError>,

Set or replace the Body in the email

Source

pub fn get_body(&self) -> Option<Body>

Fetch the Body from the email

Source

pub fn clear_body(&mut self)

Remove the Body from the email, leaving an empty body

Source

pub fn as_bytes(&self) -> Vec<u8>

Stream the email into a byte vector and return that

Source

pub fn as_string(&self) -> String

Stream the email into a byte vector, convert to a String, and return that

Trait Implementations§

Source§

impl Clone for Email

Source§

fn clone(&self) -> Email

Returns a duplicate 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 Email

Source§

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

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

impl Display for Email

Source§

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

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

impl Parsable for Email

Source§

fn parse(input: &[u8]) -> Result<(Self, &[u8]), ParseError>

Parse the object off of the beginning of the input. If found, returns Some object, and a slice containing the remainer of the input.
Source§

impl Streamable for Email

Source§

fn stream<W: Write>(&self, w: &mut W) -> Result<usize, IoError>

Serializes and sends the content out to w, returning the number of bytes written.

Auto Trait Implementations§

§

impl Freeze for Email

§

impl RefUnwindSafe for Email

§

impl Send for Email

§

impl Sync for Email

§

impl Unpin for Email

§

impl UnwindSafe for Email

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> TryFrom<T> for T

Source§

type Error = ParseError

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

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

Performs the conversion.
Source§

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

Source§

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>,

Source§

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.