pub struct Message<'a> { /* private fields */ }
Expand description
The self-referencing struct.
Implementations§
source§impl<'a> Message<'a>
impl<'a> Message<'a>
sourcepub(super) fn new(
raw: RawMessage<'a>,
parsed_builder: impl for<'this> FnOnce(&'this mut RawMessage<'a>) -> Option<Message<'this>>
) -> Message<'a>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> parsed: _ |
sourcepub(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>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> parsed: _ |
sourcepub(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>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> parsed: _ |
sourcepub(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_>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
sourcepub(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>)>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
sourcepub(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_>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
sourcepub(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>)>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
sourcepub(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_>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
sourcepub(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>)>
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:
Argument | Suggested Use |
---|---|
raw | Directly pass in the value this field should contain |
parsed_builder | Use a function or closure: (raw: &mut _) -> Result<parsed: _, Error_> |
sourcepub(super) fn with_parsed<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(&'outer_borrow Option<Message<'this>>) -> ReturnType
) -> ReturnType
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.
sourcepub(super) fn borrow_parsed<'this>(&'this self) -> &'this Option<Message<'this>>
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.
sourcepub(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
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.
sourcepub(super) fn with<'outer_borrow, ReturnType>(
&'outer_borrow self,
user: impl for<'this> FnOnce(BorrowedFields<'outer_borrow, 'this, 'a>) -> ReturnType
) -> ReturnType
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.
sourcepub(super) fn with_mut<'outer_borrow, ReturnType>(
&'outer_borrow mut self,
user: impl for<'this> FnOnce(BorrowedMutFields<'outer_borrow, 'this, 'a>) -> ReturnType
) -> ReturnType
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.
sourcepub(super) fn into_heads(self) -> Heads<'a>
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<'_>
impl Message<'_>
sourcefn parsed_builder<'a>(raw: &'a mut RawMessage<'_>) -> Option<Message<'a>>
fn parsed_builder<'a>(raw: &'a mut RawMessage<'_>) -> Option<Message<'a>>
Builds an optional message from a raw message.
sourcepub fn attachments(&self) -> Result<Vec<Attachment>, Error>
pub fn attachments(&self) -> Result<Vec<Attachment>, Error>
Returns the list of message attachment.
sourcepub fn new_tpl_builder(config: Arc<AccountConfig>) -> NewTemplateBuilder
pub fn new_tpl_builder(config: Arc<AccountConfig>) -> NewTemplateBuilder
Creates a new template builder from an account configuration.
sourcepub async fn to_read_tpl(
&self,
config: &AccountConfig,
with_interpreter: impl Fn(MimeInterpreterBuilder) -> MimeInterpreterBuilder
) -> Result<String, Error>
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.
sourcepub fn to_reply_tpl_builder(
&self,
config: Arc<AccountConfig>
) -> ReplyTemplateBuilder<'_>
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.
sourcepub fn to_forward_tpl_builder(
&self,
config: Arc<AccountConfig>
) -> ForwardTemplateBuilder<'_>
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.