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>,
}
Available on crate feature 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>
Available on crate feature pgp only.
§pgp_sender: Option<String>
Available on crate feature pgp only.
§pgp_recipient: Option<String>
Available on crate feature pgp only.

Implementations§

source§

impl MimeBodyInterpreter

source

pub fn default_save_attachments_dir() -> PathBuf

source

pub fn new() -> Self

source

pub fn with_show_multiparts(self, b: bool) -> Self

source

pub fn with_filter_parts(self, f: FilterParts) -> Self

source

pub fn with_show_plain_texts_signature(self, b: bool) -> Self

source

pub fn with_show_attachments(self, b: bool) -> Self

source

pub fn with_show_inline_attachments(self, b: bool) -> Self

source

pub fn with_save_attachments(self, b: bool) -> Self

source

pub fn with_save_attachments_dir(self, dir: impl Into<PathBuf>) -> Self

source

pub fn set_pgp(&mut self, pgp: impl Into<Pgp>)

Available on crate feature pgp only.
source

pub fn with_pgp(self, pgp: impl Into<Pgp>) -> Self

Available on crate feature pgp only.
source

pub fn set_some_pgp(&mut self, pgp: Option<impl Into<Pgp>>)

Available on crate feature pgp only.
source

pub fn with_some_pgp(self, pgp: Option<impl Into<Pgp>>) -> Self

Available on crate feature pgp only.
source

pub fn with_pgp_sender(self, sender: Option<String>) -> Self

Available on crate feature pgp only.
source

pub fn with_pgp_recipient(self, recipient: Option<String>) -> Self

Available on crate feature pgp only.
source

fn escape_mml_markup(text: String) -> String

Replace normal opening and closing tags by escaped opening and closing tags.

source

async fn decrypt_part(&self, encrypted_part: &MessagePart<'_>) -> Result<String>

Available on crate feature pgp only.

Decrypt the given MessagePart using PGP.

source

async fn verify_msg(&self, msg: &Message<'_>, ids: &[usize]) -> Result<()>

Available on crate feature pgp only.

Verify the given Message using PGP.

source

fn interpret_attachment( &self, ctype: &str, part: &MessagePart<'_>, data: &[u8] ) -> Result<String>

source

fn interpret_inline_attachment( &self, ctype: &str, part: &MessagePart<'_>, data: &[u8] ) -> Result<String>

source

fn interpret_text(&self, ctype: &str, text: &str) -> String

source

fn interpret_text_plain(&self, plain: &str) -> String

source

fn interpret_text_html(&self, html: &str) -> String

source

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,

source

pub async fn interpret_msg<'a>(&self, msg: &Message<'a>) -> Result<String>

Interpret the given MIME Message as a MML message string.

source

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.

source

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

source§

fn clone(&self) -> MimeBodyInterpreter

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
source§

impl Debug for MimeBodyInterpreter

source§

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

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

impl Default for MimeBodyInterpreter

source§

fn default() -> Self

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

impl PartialEq for MimeBodyInterpreter

source§

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

impl Eq for MimeBodyInterpreter

source§

impl StructuralPartialEq for MimeBodyInterpreter

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

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

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> NoneValue for T
where T: Default,

§

type NoneType = T

source§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
source§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
source§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
source§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a MaybeRef.
source§

impl<T> ToOwned for T
where 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<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

source§

impl<'p, T> OrderedSeq<'p, T> for T
where T: Clone,