Skip to main content

MessageTransformer

Trait MessageTransformer 

Source
pub trait MessageTransformer: Send + Sync {
    // Required methods
    fn transform<'a>(
        &'a self,
        message: &'a mut EmailMessage,
    ) -> TransformFuture<'a>;
    fn name(&self) -> &str;

    // Provided method
    fn apply<'a>(
        transformers: &'a [Box<dyn MessageTransformer>],
        message: &'a mut EmailMessage,
    ) -> TransformFuture<'a>
       where Self: Sized { ... }
}
Expand description

Trait for message transformers that modify emails in the pipeline.

Transformers run after EmailMessage construction and before routing, allowing in-place modification of message fields and body. Transformers may perform async operations such as DNS lookups.

Required Methods§

Source

fn transform<'a>(&'a self, message: &'a mut EmailMessage) -> TransformFuture<'a>

Transforms an email message in place, possibly performing async operations.

Source

fn name(&self) -> &str

Returns the name of this transformer.

Provided Methods§

Source

fn apply<'a>( transformers: &'a [Box<dyn MessageTransformer>], message: &'a mut EmailMessage, ) -> TransformFuture<'a>
where Self: Sized,

Applies a list of transformers to a message in order.

Implementors§