Trait FilterT

Source
pub trait FilterT<F: FilterT<F, V = Self::V> = Self> {
    type V: ValT;

    // Required methods
    fn run<'a>(
        &'a self,
        lut: &'a Lut<F>,
        cv: Cv<'a, Self::V>,
    ) -> ValXs<'a, Self::V>;
    fn update<'a>(
        &'a self,
        lut: &'a Lut<F>,
        cv: Cv<'a, Self::V>,
        f: Box<dyn Update<'a, Self::V> + 'a>,
    ) -> ValXs<'a, Self::V>;

    // Provided methods
    fn pipe<'a, T: 'a>(
        &'a self,
        lut: &'a Lut<F>,
        cv: Cv<'a, Self::V>,
        f: impl Fn(Cv<'a, Self::V>, Self::V) -> Results<'a, T, Exn<'a, Self::V>> + 'a,
    ) -> Results<'a, T, Exn<'a, Self::V>> { ... }
    fn cartesian<'a>(
        &'a self,
        r: &'a Self,
        lut: &'a Lut<F>,
        cv: Cv<'a, Self::V>,
    ) -> BoxIter<'a, (ValX<'a, Self::V>, ValX<'a, Self::V>)> { ... }
}
Expand description

Function from a value to a stream of value results.

F is the type of (natively implemented) filter functions.

Required Associated Types§

Source

type V: ValT

Type of values that the filter takes and yields.

This is an associated type because it is strictly determined by F.

Required Methods§

Source

fn run<'a>(&'a self, lut: &'a Lut<F>, cv: Cv<'a, Self::V>) -> ValXs<'a, Self::V>

f.run((c, v)) returns the output of v | f in the context c.

Source

fn update<'a>( &'a self, lut: &'a Lut<F>, cv: Cv<'a, Self::V>, f: Box<dyn Update<'a, Self::V> + 'a>, ) -> ValXs<'a, Self::V>

p.update((c, v), f) returns the output of v | p |= f in the context c.

Provided Methods§

Source

fn pipe<'a, T: 'a>( &'a self, lut: &'a Lut<F>, cv: Cv<'a, Self::V>, f: impl Fn(Cv<'a, Self::V>, Self::V) -> Results<'a, T, Exn<'a, Self::V>> + 'a, ) -> Results<'a, T, Exn<'a, Self::V>>

For every value v returned by self.run(cv), call f(cv, v) and return all results.

This has a special optimisation for the case where only a single v is returned. In that case, we can consume cv instead of cloning it.

Source

fn cartesian<'a>( &'a self, r: &'a Self, lut: &'a Lut<F>, cv: Cv<'a, Self::V>, ) -> BoxIter<'a, (ValX<'a, Self::V>, ValX<'a, Self::V>)>

Run self and r and return the cartesian product of their outputs.

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: FilterT<F>> FilterT<F> for TermId

Source§

type V = <F as FilterT>::V

Source§

impl<V: ValT> FilterT for Native<V>

Source§

type V = V