pub trait Filter<T>: Clone {
    // Required method
    fn matches(&self, item: &T) -> bool;
}
Expand description

A filter that allows a service to be executed based on a condition

§Example


#[derive(Debug, Clone)]
struct MyFilter;

impl<T> Filter<T> for MyFilter {
    fn matches(&self, _: &T) -> bool {
        true
    }
}

let filter = MyFilter;
assert_eq!(filter.matches(&()), true);

Required Methods§

source

fn matches(&self, item: &T) -> bool

Whether the service should be executed

If true, the service will be executed, otherwise it will fall through to the next service.

Object Safety§

This trait is not object safe.

Implementors§