Struct email::message::Message

source ·
pub struct Message<'a> { /* private fields */ }
Expand description

The self-referencing struct.

Implementations§

source§

impl<'a> Message<'a>

source

pub(super) fn new( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Option<Message<'this>> ) -> Message<'a>

Constructs a new instance of this self-referential struct. (See also MessageBuilder::build()). Each argument is a field of the new struct. Fields that refer to other fields inside the struct are initialized using functions instead of directly passing their value. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> parsed: _
source

pub(super) async fn new_async( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Pin<Box<dyn Future<Output = Option<Message<'this>>> + 'this>> ) -> Message<'a>

Constructs a new instance of this self-referential struct. (See also MessageAsyncBuilder::build()). Each argument is a field of the new struct. Fields that refer to other fields inside the struct are initialized using functions instead of directly passing their value. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> parsed: _
source

pub(super) async fn new_async_send( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Pin<Box<dyn Future<Output = Option<Message<'this>>> + Send + 'this>> ) -> Message<'a>

Constructs a new instance of this self-referential struct. (See also MessageAsyncSendBuilder::build()). Each argument is a field of the new struct. Fields that refer to other fields inside the struct are initialized using functions instead of directly passing their value. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> parsed: _
source

pub(super) fn try_new<Error_>( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Result<Option<Message<'this>>, Error_> ) -> Result<Message<'a>, Error_>

(See also MessageTryBuilder::try_build().) Like new, but builders for self-referencing fields can return results. If any of them fail, Err is returned. If all of them succeed, Ok is returned. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> Result<parsed: _, Error_>
source

pub(super) fn try_new_or_recover<Error_>( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Result<Option<Message<'this>>, Error_> ) -> Result<Message<'a>, (Error_, Heads<'a>)>

(See also MessageTryBuilder::try_build_or_recover().) Like try_new, but all head fields are returned in the case of an error. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> Result<parsed: _, Error_>
source

pub(super) async fn try_new_async<Error_>( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Pin<Box<dyn Future<Output = Result<Option<Message<'this>>, Error_>> + 'this>> ) -> Result<Message<'a>, Error_>

(See also MessageAsyncTryBuilder::try_build().) Like new, but builders for self-referencing fields can return results. If any of them fail, Err is returned. If all of them succeed, Ok is returned. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> Result<parsed: _, Error_>
source

pub(super) async fn try_new_or_recover_async<Error_>( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Pin<Box<dyn Future<Output = Result<Option<Message<'this>>, Error_>> + 'this>> ) -> Result<Message<'a>, (Error_, Heads<'a>)>

(See also MessageAsyncTryBuilder::try_build_or_recover().) Like try_new, but all head fields are returned in the case of an error. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> Result<parsed: _, Error_>
source

pub(super) async fn try_new_async_send<Error_>( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Pin<Box<dyn Future<Output = Result<Option<Message<'this>>, Error_>> + Send + 'this>> ) -> Result<Message<'a>, Error_>

(See also MessageAsyncSendTryBuilder::try_build().) Like new, but builders for self-referencing fields can return results. If any of them fail, Err is returned. If all of them succeed, Ok is returned. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> Result<parsed: _, Error_>
source

pub(super) async fn try_new_or_recover_async_send<Error_>( raw: RawMessage<'a>, parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Pin<Box<dyn Future<Output = Result<Option<Message<'this>>, Error_>> + Send + 'this>> ) -> Result<Message<'a>, (Error_, Heads<'a>)>

(See also MessageAsyncSendTryBuilder::try_build_or_recover().) Like try_new, but all head fields are returned in the case of an error. The arguments are as follows:

ArgumentSuggested Use
rawDirectly pass in the value this field should contain
parsed_builderUse a function or closure: (raw: &mut _) -> Result<parsed: _, Error_>
source

pub(super) fn with_parsed<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(&'outer_borrow Option<Message<'this>>) -> ReturnType ) -> ReturnType

Provides an immutable reference to parsed. This method was generated because parsed is a tail field.

source

pub(super) fn borrow_parsed<'this>(&'this self) -> &'this Option<Message<'this>>

Provides an immutable reference to parsed. This method was generated because parsed is a tail field.

source

pub(super) fn with_parsed_mut<'outer_borrow, ReturnType>( &'outer_borrow mut self, user: impl for<'this> FnOnce(&'outer_borrow mut Option<Message<'this>>) -> ReturnType ) -> ReturnType

Provides a mutable reference to parsed. This method was generated because parsed is a tail field. No borrow_parsed_mut function was generated because Rust’s borrow checker is currently unable to guarantee that such a method would be used safely.

source

pub(super) fn with<'outer_borrow, ReturnType>( &'outer_borrow self, user: impl for<'this> FnOnce(BorrowedFields<'outer_borrow, 'this, 'a>) -> ReturnType ) -> ReturnType

This method provides immutable references to all tail and immutably borrowed fields.

source

pub(super) fn with_mut<'outer_borrow, ReturnType>( &'outer_borrow mut self, user: impl for<'this> FnOnce(BorrowedMutFields<'outer_borrow, 'this, 'a>) -> ReturnType ) -> ReturnType

This method provides mutable references to all tail fields.

source

pub(super) fn into_heads(self) -> Heads<'a>

This function drops all internally referencing fields and returns only the head fields of this struct.

source§

impl Message<'_>

source

fn parsed_builder<'a>(raw: &'a mut RawMessage<'_>) -> Option<Message<'a>>

Builds an optional message from a raw message.

source

pub fn parsed(&self) -> Result<&Message<'_>, Error>

Returns the parsed version of the message.

source

pub fn raw(&self) -> Result<&[u8], Error>

Returns the raw version of the message.

source

pub fn attachments(&self) -> Result<Vec<Attachment>, Error>

Returns the list of message attachment.

source

pub fn new_tpl_builder(config: Arc<AccountConfig>) -> NewTemplateBuilder

Creates a new template builder from an account configuration.

source

pub async fn to_read_tpl( &self, config: &AccountConfig, with_interpreter: impl Fn(MimeInterpreterBuilder) -> MimeInterpreterBuilder ) -> Result<String, Error>

Turns the current message into a read.

source

pub fn to_reply_tpl_builder( &self, config: Arc<AccountConfig> ) -> ReplyTemplateBuilder<'_>

Turns the current message into a reply template builder.

The fact to return a template builder makes it easier to customize the final template from the outside.

source

pub fn to_forward_tpl_builder( &self, config: Arc<AccountConfig> ) -> ForwardTemplateBuilder<'_>

Turns the current message into a forward template builder.

The fact to return a template builder makes it easier to customize the final template from the outside.

Trait Implementations§

source§

impl<'a> From<&'a [u8]> for Message<'a>

source§

fn from(bytes: &'a [u8]) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a Fetch<'a>> for Message<'a>

source§

fn from(fetch: &'a Fetch<'_>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut MailEntry> for Message<'a>

source§

fn from(entry: &'a mut MailEntry) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for Message<'a>

source§

fn from(str: &'a str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Vec<u8>> for Message<'a>

source§

fn from(bytes: Vec<u8>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Message<'a>

§

impl<'a> RefUnwindSafe for Message<'a>

§

impl<'a> Send for Message<'a>

§

impl<'a> Sync for Message<'a>

§

impl<'a> Unpin for Message<'a>

§

impl<'a> UnwindSafe for Message<'a>

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<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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, Dst> ConvAsUtil<Dst> for T

source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
source§

impl<T> ConvUtil for T

source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
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<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
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> MaybeSync for T