Skip to main content

FieldValuesFilter

Trait FieldValuesFilter 

Source
pub trait FieldValuesFilter<F: Field, V> {
    // Required methods
    fn matching_mode(&self) -> &MatchingMode;
    fn match_one(&self, field: &F, value: &V) -> bool;
    fn max_matches(&self) -> usize;

    // Provided methods
    fn matches<'a, I: Iterator<Item = (&'a F, &'a V)>>(
        &'a self,
        items: I,
    ) -> bool
       where F: 'a,
             V: 'a { ... }
    fn match_all<'a, I: Iterator<Item = (&'a F, &'a V)>>(
        &'a self,
        items: I,
    ) -> bool
       where F: 'a,
             V: 'a { ... }
    fn match_any<'a, I: Iterator<Item = (&'a F, &'a V)>>(
        &'a self,
        items: I,
    ) -> bool
       where F: 'a,
             V: 'a { ... }
    fn match_none<'a, I: Iterator<Item = (&'a F, &'a V)>>(
        &'a self,
        items: I,
    ) -> bool
       where F: 'a,
             V: 'a { ... }
}
Expand description

Filtering behavior that check some field value. Most methods have default implementations. By implementing the matching_mode and match_one methods you should have a working implementation. You can override the default implementations for efficiency if needed.

Required Methods§

Source

fn matching_mode(&self) -> &MatchingMode

Matching mode that determines how to match the field values.

Source

fn match_one(&self, field: &F, value: &V) -> bool

Match one field value against this filter.

Source

fn max_matches(&self) -> usize

Maximum number of fields to match.

Provided Methods§

Source

fn matches<'a, I: Iterator<Item = (&'a F, &'a V)>>(&'a self, items: I) -> bool
where F: 'a, V: 'a,

Whether the given field and value satisfy this filter.

Source

fn match_all<'a, I: Iterator<Item = (&'a F, &'a V)>>(&'a self, items: I) -> bool
where F: 'a, V: 'a,

Check whether all filtering fields are a match.

Source

fn match_any<'a, I: Iterator<Item = (&'a F, &'a V)>>(&'a self, items: I) -> bool
where F: 'a, V: 'a,

Match any one field of the filter.

Source

fn match_none<'a, I: Iterator<Item = (&'a F, &'a V)>>( &'a self, items: I, ) -> bool
where F: 'a, V: 'a,

Match none of the filter’s fields.

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: Field, VF: ValueFilter<V>, V> FieldValuesFilter<F, V> for BTreeFieldValuesFilter<F, VF, V>