Trait jaq_interpret::FilterT
source · 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§
Provided Methods§
sourcefn 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 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.
sourcefn cartesian(
self,
r: Self,
cv: (Ctx<'a>, Val)
) -> Box<dyn Iterator<Item = (ValR, ValR)> + 'a>
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.
sourcefn cartesian3(
self,
m: Self,
r: Self,
cv: (Ctx<'a>, Val)
) -> Box<dyn Iterator<Item = (ValR, ValR, ValR)> + 'a>
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.
sourcefn recurse(self, inner: bool, outer: bool, cv: (Ctx<'a>, Val)) -> ValRs<'_>
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.
Object Safety§
This trait is not object safe.