lib

Trait Query

Source
pub trait Query<T> {
    // Required method
    fn is_match(&self, t: &T) -> bool;

    // Provided method
    fn matching_elements<'a>(
        &self,
        a: impl IntoIterator<Item = &'a T>,
    ) -> Vec<&'a T> { ... }
}
Expand description

A Query matches against elements of some kind,

Required Methods§

Source

fn is_match(&self, t: &T) -> bool

returns true if query is a match.

Provided Methods§

Source

fn matching_elements<'a>( &self, a: impl IntoIterator<Item = &'a T>, ) -> Vec<&'a T>

collects a vector of all elements that match the query.

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.

Implementors§

Source§

impl<F: Fn(&T) -> bool, T> Query<T> for F