ValueFilter

Struct ValueFilter 

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

A treefrog leaper based on a predicate of prefix and value. Use like ValueFilter::from(|tuple, value| ...). The closure should return true if value ought to be retained. The value will be a value proposed elsewhere by an extend_with leaper.

This leaper cannot be used in isolation, it must be combined with other leapers.

Implementations§

Source§

impl<'leap, Tuple, Val, Func> ValueFilter<Tuple, Val, Func>
where Func: Fn(&Tuple, &Val) -> 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 ValueFilter<Tuple, Val, Func>
where Func: Fn(&Tuple, &Val) -> 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.

Auto Trait Implementations§

§

impl<Tuple, Val, Func> Freeze for ValueFilter<Tuple, Val, Func>
where Func: Freeze,

§

impl<Tuple, Val, Func> RefUnwindSafe for ValueFilter<Tuple, Val, Func>
where Func: RefUnwindSafe, Tuple: RefUnwindSafe, Val: RefUnwindSafe,

§

impl<Tuple, Val, Func> Send for ValueFilter<Tuple, Val, Func>
where Func: Send, Tuple: Send, Val: Send,

§

impl<Tuple, Val, Func> Sync for ValueFilter<Tuple, Val, Func>
where Func: Sync, Tuple: Sync, Val: Sync,

§

impl<Tuple, Val, Func> Unpin for ValueFilter<Tuple, Val, Func>
where Func: Unpin, Tuple: Unpin, Val: Unpin,

§

impl<Tuple, Val, Func> UnwindSafe for ValueFilter<Tuple, Val, Func>
where Func: UnwindSafe, Tuple: UnwindSafe, Val: 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.