Struct mml::message::MimeBodyInterpreter
source · pub struct MimeBodyInterpreter {
show_multiparts: bool,
filter_parts: FilterParts,
show_plain_texts_signature: bool,
show_attachments: bool,
show_inline_attachments: bool,
save_attachments: bool,
save_attachments_dir: PathBuf,
pgp: Option<Pgp>,
pgp_sender: Option<String>,
pgp_recipient: Option<String>,
}
interpreter
only.Expand description
MIME → MML message body interpreter.
The interpreter follows the builder pattern, where the build function
is named interpret_*
.
Fields§
§show_multiparts: bool
Show multipart structure when true.
It is useful to see how nested parts are structured. If
false
then multipart structure is flatten, which means all
parts and subparts are shown at the same top level.
filter_parts: FilterParts
Filter parts to show by MIME type.
show_plain_texts_signature: bool
If false
then tries to remove signatures for text plain
parts starting by the standard delimiter -- \n
.
show_attachments: bool
If true
then shows attachments at the end of the body as MML
part.
show_inline_attachments: bool
If true
then shows inline attachments at the end of the body
as MML part.
save_attachments: bool
An attachment is interpreted this way: <#part filename=attachment.ext>
. If true
then the file (with its
content) is automatically created at the given
filename. Directory can be customized via
save_attachments_dir
. This option is particularly useful
when transferring an email with its attachments.
save_attachments_dir: PathBuf
Saves attachments to the given directory instead of the
default temporary one given by std::env::temp_dir()
.
pgp: Option<Pgp>
pgp
only.pgp_sender: Option<String>
pgp
only.pgp_recipient: Option<String>
pgp
only.Implementations§
source§impl MimeBodyInterpreter
impl MimeBodyInterpreter
pub fn default_save_attachments_dir() -> PathBuf
pub fn new() -> Self
pub fn with_show_multiparts(self, b: bool) -> Self
pub fn with_filter_parts(self, f: FilterParts) -> Self
pub fn with_show_plain_texts_signature(self, b: bool) -> Self
pub fn with_show_attachments(self, b: bool) -> Self
pub fn with_show_inline_attachments(self, b: bool) -> Self
pub fn with_save_attachments(self, b: bool) -> Self
pub fn with_save_attachments_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn set_pgp(&mut self, pgp: impl Into<Pgp>)
pgp
only.pub fn with_pgp(self, pgp: impl Into<Pgp>) -> Self
pgp
only.pub fn set_some_pgp(&mut self, pgp: Option<impl Into<Pgp>>)
pgp
only.pub fn with_some_pgp(self, pgp: Option<impl Into<Pgp>>) -> Self
pgp
only.pub fn with_pgp_sender(self, sender: Option<String>) -> Self
pgp
only.pub fn with_pgp_recipient(self, recipient: Option<String>) -> Self
pgp
only.sourcefn escape_mml_markup(text: String) -> String
fn escape_mml_markup(text: String) -> String
Replace normal opening and closing tags by escaped opening and closing tags.
sourceasync fn decrypt_part(&self, encrypted_part: &MessagePart<'_>) -> Result<String>
Available on crate feature pgp
only.
async fn decrypt_part(&self, encrypted_part: &MessagePart<'_>) -> Result<String>
pgp
only.Decrypt the given MessagePart using PGP.
sourceasync fn verify_msg(&self, msg: &Message<'_>, ids: &[usize]) -> Result<()>
Available on crate feature pgp
only.
async fn verify_msg(&self, msg: &Message<'_>, ids: &[usize]) -> Result<()>
pgp
only.Verify the given Message using PGP.
fn interpret_attachment( &self, ctype: &str, part: &MessagePart<'_>, data: &[u8] ) -> Result<String>
fn interpret_inline_attachment( &self, ctype: &str, part: &MessagePart<'_>, data: &[u8] ) -> Result<String>
fn interpret_text(&self, ctype: &str, text: &str) -> String
fn interpret_text_plain(&self, plain: &str) -> String
fn interpret_text_html(&self, html: &str) -> String
fn interpret_part<'life0, 'life1, 'life_self, 'async_recursion>(
&'life_self self,
msg: &'life0 Message<'_>,
part: &'life1 MessagePart<'_>
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_recursion>>where
'life0: 'async_recursion,
'life1: 'async_recursion,
'life_self: 'async_recursion,
sourcepub async fn interpret_msg<'a>(&self, msg: &Message<'a>) -> Result<String>
pub async fn interpret_msg<'a>(&self, msg: &Message<'a>) -> Result<String>
Interpret the given MIME Message as a MML message string.
sourcepub async fn interpret_bytes<'a>(
&self,
bytes: impl AsRef<[u8]> + 'a
) -> Result<String>
pub async fn interpret_bytes<'a>( &self, bytes: impl AsRef<[u8]> + 'a ) -> Result<String>
Interpret the given MIME message bytes as a MML message string.
sourcepub async fn interpret_msg_builder<'a>(
&self,
builder: MessageBuilder<'a>
) -> Result<String>
pub async fn interpret_msg_builder<'a>( &self, builder: MessageBuilder<'a> ) -> Result<String>
Interpret the given MIME MessageBuilder as a MML message string.
Trait Implementations§
source§impl Clone for MimeBodyInterpreter
impl Clone for MimeBodyInterpreter
source§fn clone(&self) -> MimeBodyInterpreter
fn clone(&self) -> MimeBodyInterpreter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MimeBodyInterpreter
impl Debug for MimeBodyInterpreter
source§impl Default for MimeBodyInterpreter
impl Default for MimeBodyInterpreter
source§impl PartialEq for MimeBodyInterpreter
impl PartialEq for MimeBodyInterpreter
source§fn eq(&self, other: &MimeBodyInterpreter) -> bool
fn eq(&self, other: &MimeBodyInterpreter) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for MimeBodyInterpreter
impl StructuralPartialEq for MimeBodyInterpreter
Auto Trait Implementations§
impl Freeze for MimeBodyInterpreter
impl !RefUnwindSafe for MimeBodyInterpreter
impl Send for MimeBodyInterpreter
impl Sync for MimeBodyInterpreter
impl Unpin for MimeBodyInterpreter
impl !UnwindSafe for MimeBodyInterpreter
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.