Trait jaq_interpret::FilterT
source · pub trait FilterT<'a, V: ValT = Val>: Clone + 'a {
// Required methods
fn run(
self,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = Result<V, Error<V>>> + 'a>;
fn update(
self,
cv: (Ctx<'a, V>, V),
f: Box<dyn Update<'a, V> + 'a>
) -> Box<dyn Iterator<Item = Result<V, Error<V>>> + 'a>;
// Provided methods
fn pipe<T: 'a, F>(
self,
cv: (Ctx<'a, V>, V),
f: F
) -> Results<'a, T, Error<V>>
where F: Fn((Ctx<'a, V>, V), V) -> Results<'a, T, Error<V>> + 'a { ... }
fn cartesian(
self,
r: Self,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = (Result<V, Error<V>>, Result<V, Error<V>>)> + 'a> { ... }
fn cartesian3(
self,
m: Self,
r: Self,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = (Result<V, Error<V>>, Result<V, Error<V>>, Result<V, Error<V>>)> + 'a> { ... }
fn recurse(
self,
inner: bool,
outer: bool,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = Result<V, Error<V>>> + '_> { ... }
fn recurse_update(
self,
cv: (Ctx<'a, V>, V),
f: Box<dyn Update<'a, V> + 'a>
) -> Box<dyn Iterator<Item = Result<V, Error<V>>> + '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, V>, V), f: F) -> Results<'a, T, Error<V>>
fn pipe<T: 'a, F>(self, cv: (Ctx<'a, V>, V), f: F) -> Results<'a, T, Error<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.
sourcefn cartesian(
self,
r: Self,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = (Result<V, Error<V>>, Result<V, Error<V>>)> + 'a>
fn cartesian( self, r: Self, cv: (Ctx<'a, V>, V) ) -> Box<dyn Iterator<Item = (Result<V, Error<V>>, Result<V, Error<V>>)> + 'a>
Run self and r and return the cartesian product of their outputs.
sourcefn cartesian3(
self,
m: Self,
r: Self,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = (Result<V, Error<V>>, Result<V, Error<V>>, Result<V, Error<V>>)> + 'a>
fn cartesian3( self, m: Self, r: Self, cv: (Ctx<'a, V>, V) ) -> Box<dyn Iterator<Item = (Result<V, Error<V>>, Result<V, Error<V>>, Result<V, Error<V>>)> + 'a>
Run self, m, and r, and return the cartesian product of their outputs.
sourcefn recurse(
self,
inner: bool,
outer: bool,
cv: (Ctx<'a, V>, V)
) -> Box<dyn Iterator<Item = Result<V, Error<V>>> + '_>
👎Deprecated since 1.2.0
fn recurse( self, inner: bool, outer: bool, cv: (Ctx<'a, V>, V) ) -> Box<dyn Iterator<Item = Result<V, Error<V>>> + '_>
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.