pub trait FilterT<'a>: Clone + 'a {
    // Required methods
    fn run(self, cv: (Ctx<'a>, Val)) -> ValRs<'a>;
    fn update(
        self,
        cv: (Ctx<'a>, Val),
        f: Box<dyn Update<'a> + 'a>
    ) -> ValRs<'a>;

    // Provided methods
    fn pipe<T: 'a, F>(self, cv: (Ctx<'a>, Val), f: F) -> Results<'a, T, Error>
       where F: Fn((Ctx<'a>, Val), Val) -> Results<'a, T, Error> + 'a { ... }
    fn cartesian(
        self,
        r: Self,
        cv: (Ctx<'a>, Val)
    ) -> Box<dyn Iterator<Item = (ValR, ValR)> + 'a> { ... }
    fn cartesian3(
        self,
        m: Self,
        r: Self,
        cv: (Ctx<'a>, Val)
    ) -> Box<dyn Iterator<Item = (ValR, ValR, ValR)> + 'a> { ... }
    fn recurse(self, inner: bool, outer: bool, cv: (Ctx<'a>, Val)) -> ValRs<'_> { ... }
    fn recurse_update(
        self,
        cv: (Ctx<'a>, Val),
        f: Box<dyn Update<'a> + 'a>
    ) -> ValRs<'a> { ... }
}
Expand description

Function from a value to a stream of value results.

Required Methods§

source

fn run(self, cv: (Ctx<'a>, Val)) -> ValRs<'a>

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

source

fn update(self, cv: (Ctx<'a>, Val), f: Box<dyn Update<'a> + 'a>) -> ValRs<'a>

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

Provided Methods§

source

fn pipe<T: 'a, F>(self, cv: (Ctx<'a>, Val), f: F) -> Results<'a, T, Error>where F: Fn((Ctx<'a>, Val), Val) -> Results<'a, T, Error> + 'a,

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( self, r: Self, cv: (Ctx<'a>, Val) ) -> Box<dyn Iterator<Item = (ValR, ValR)> + 'a>

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

source

fn cartesian3( self, m: Self, r: Self, cv: (Ctx<'a>, Val) ) -> Box<dyn Iterator<Item = (ValR, ValR, ValR)> + 'a>

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

source

fn recurse(self, inner: bool, outer: bool, cv: (Ctx<'a>, Val)) -> ValRs<'_>

👎Deprecated since 1.2.0

Return the output of recurse(f) if inner and outer are true.

This function implements a generalisation of recurse(f): if inner is true, it returns values for which f yields at least one output, and if outer is true, it returns values for which f yields no output. This is useful to implement while and until.

source

fn recurse_update( self, cv: (Ctx<'a>, Val), f: Box<dyn Update<'a> + 'a> ) -> ValRs<'a>

👎Deprecated since 1.2.0

Return the output of recurse(l) |= f.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a> FilterT<'a> for &'a Owned