Skip to main content

Filter

Trait Filter 

Source
pub trait Filter {
    // Required method
    fn matches<E>(&self, evt: E) -> bool
       where E: ToEvent;

    // Provided methods
    fn and_when<U>(self, other: U) -> And<Self, U>
       where Self: Sized { ... }
    fn or_when<U>(self, other: U) -> Or<Self, U>
       where Self: Sized { ... }
}
Expand description

A filter over Events.

Filters can be evaluated with a call to Filter::matches.

Required Methods§

Source

fn matches<E>(&self, evt: E) -> bool
where E: ToEvent,

Evaluate an event against the filter.

If this method return true then the event has passed the filter. If this method returns false then the event has failed the filter.

Provided Methods§

Source

fn and_when<U>(self, other: U) -> And<Self, U>
where Self: Sized,

self && other.

If self evaluates to true then other will be evaluated.

Source

fn or_when<U>(self, other: U) -> Or<Self, U>
where Self: Sized,

self || other.

If self evaluates to false then other will be evaluated.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Filter for fn(Event<'_, &dyn ErasedProps>) -> bool

Source§

fn matches<E>(&self, evt: E) -> bool
where E: ToEvent,

Source§

impl<'a, F> Filter for &'a F
where F: Filter + ?Sized,

Source§

fn matches<E>(&self, evt: E) -> bool
where E: ToEvent,

Source§

impl<'a, F> Filter for Box<F>
where F: Filter + 'a + ?Sized,

Available on crate feature alloc only.
Source§

fn matches<E>(&self, evt: E) -> bool
where E: ToEvent,

Source§

impl<'a, F> Filter for Arc<F>
where F: Filter + 'a + ?Sized,

Available on crate feature alloc only.
Source§

fn matches<E>(&self, evt: E) -> bool
where E: ToEvent,

Source§

impl<F> Filter for Option<F>
where F: Filter,

Source§

fn matches<E>(&self, evt: E) -> bool
where E: ToEvent,

Implementors§

Source§

impl Filter for Always

Source§

impl Filter for KindFilter

Source§

impl Filter for Empty

Source§

impl<'a> Filter for dyn ErasedFilter + 'a

Source§

impl<'a> Filter for dyn ErasedFilter + Send + Sync + 'a

Source§

impl<F> Filter for FromFn<F>
where F: Fn(Event<'_, &dyn ErasedProps>) -> bool,

Source§

impl<L: for<'a> FromValue<'a> + Ord + Default> Filter for MinLevelFilter<L>

Source§

impl<L: for<'a> FromValue<'a> + Ord + Default> Filter for MinLevelPathMap<L>

Source§

impl<T> Filter for AssertInternal<T>
where T: Filter,

Source§

impl<T, U> Filter for And<T, U>
where T: Filter, U: Filter,

Source§

impl<T, U> Filter for Or<T, U>
where T: Filter, U: Filter,