Skip to main content

EnvelopeFilter

Trait EnvelopeFilter 

pub trait EnvelopeFilter: Sealed {
    // Required method
    fn filter(&mut self, item: &EnvelopeItem) -> bool;

    // Provided method
    fn on_filtered(&mut self, item: EnvelopeItem) { ... }
}
Expand description

A trait for types which can filter items in envelopes.

This trait is used by Envelope::filter.

Required Methods§

fn filter(&mut self, item: &EnvelopeItem) -> bool

The function used to filter the envelopes.

A return value of true indicates that the item should be kept in the envelope, false will filter the value out.

A value of true does not guarantee the item is kept; in particular, Envelope::filter removes attachments if the corresponding event or transaction item is removed from the envelope, as it no longer makes sense to send them in this case.

Provided Methods§

fn on_filtered(&mut self, item: EnvelopeItem)

A callback which is called with all items removed by filtering, including items for which Self::filter had returned true, such as no-longer-applicable attachments.

Implementors§

§

impl<F> EnvelopeFilter for F
where F: FnMut(&EnvelopeItem) -> bool,

§

impl<F, C> EnvelopeFilter for EnvelopeFilterCallbacks<F, C>