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