Struct PrefixFilter

Source
pub struct PrefixFilter<Tuple, Func: Fn(&Tuple) -> bool> { /* private fields */ }
Expand description

A treefrog leaper that tests each of the tuples from the main input (the “prefix”). Use like PrefixFilter::from(|tuple| ...); if the closure returns true, then the tuple is retained, else it will be ignored. This leaper can be used in isolation in which case it just acts like a filter on the input (the “proposed value” will be () type).

Implementations§

Source§

impl<'leap, Tuple, Func> PrefixFilter<Tuple, Func>
where Func: Fn(&Tuple) -> bool,

Source

pub fn from(predicate: Func) -> Self

Creates a new filter based on the prefix

Trait Implementations§

Source§

impl<'leap, Tuple, Val, Func> Leaper<'leap, Tuple, Val> for PrefixFilter<Tuple, Func>
where Func: Fn(&Tuple) -> bool,

Source§

fn count(&mut self, prefix: &Tuple) -> usize

Estimates the number of proposed values.

Source§

fn propose(&mut self, _prefix: &Tuple, _values: &mut Vec<&'leap Val>)

Populates values with proposed values.

Source§

fn intersect(&mut self, _prefix: &Tuple, _values: &mut Vec<&'leap Val>)

Restricts values to proposed values.

Source§

impl<'leap, Tuple, Func> Leapers<'leap, Tuple, ()> for PrefixFilter<Tuple, Func>
where Func: Fn(&Tuple) -> bool,

Source§

fn for_each_count(&mut self, tuple: &Tuple, op: impl FnMut(usize, usize))

Internal method:
Source§

fn propose(&mut self, _: &Tuple, min_index: usize, values: &mut Vec<&'leap ()>)

Internal method:
Source§

fn intersect( &mut self, _: &Tuple, min_index: usize, values: &mut Vec<&'leap ()>, )

Internal method:

Auto Trait Implementations§

§

impl<Tuple, Func> Freeze for PrefixFilter<Tuple, Func>
where Func: Freeze,

§

impl<Tuple, Func> RefUnwindSafe for PrefixFilter<Tuple, Func>
where Func: RefUnwindSafe, Tuple: RefUnwindSafe,

§

impl<Tuple, Func> Send for PrefixFilter<Tuple, Func>
where Func: Send, Tuple: Send,

§

impl<Tuple, Func> Sync for PrefixFilter<Tuple, Func>
where Func: Sync, Tuple: Sync,

§

impl<Tuple, Func> Unpin for PrefixFilter<Tuple, Func>
where Func: Unpin, Tuple: Unpin,

§

impl<Tuple, Func> UnwindSafe for PrefixFilter<Tuple, Func>
where Func: UnwindSafe, Tuple: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.