pub trait Iterate<G: Scope, D: Data, R: Semigroup> {
// Required method
fn iterate<F>(&self, logic: F) -> Collection<G, D, R>
where G::Timestamp: Lattice,
for<'a> F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>;
}
Expand description
An extension trait for the iterate
method.
Required Methods§
Sourcefn iterate<F>(&self, logic: F) -> Collection<G, D, R>where
G::Timestamp: Lattice,
for<'a> F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>,
fn iterate<F>(&self, logic: F) -> Collection<G, D, R>where
G::Timestamp: Lattice,
for<'a> F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>,
Iteratively apply logic
to the source collection until convergence.
Importantly, this method does not automatically consolidate results.
It may be important to conclude with consolidate()
to ensure that
logically empty collections that contain cancelling records do not
result in non-termination. Operators like reduce
, distinct
, and
count
also perform consolidation, and are safe to conclude with.
§Examples
use differential_dataflow::input::Input;
use differential_dataflow::operators::Iterate;
::timely::example(|scope| {
scope.new_collection_from(1 .. 10u32).1
.iterate(|values| {
values.map(|x| if x % 2 == 0 { x/2 } else { x })
.consolidate()
});
});
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.