pub trait Iterate<G: Scope<Timestamp: Lattice>, D: Data, R: Semigroup> {
// Required method
fn iterate<F>(self, logic: F) -> VecCollection<G, D, R>
where for<'a> F: FnOnce(Iterative<'a, G, u64>, VecCollection<Iterative<'a, G, u64>, D, R>) -> VecCollection<Iterative<'a, G, u64>, D, R>;
}Expand description
An extension trait for the iterate method.
Required Methods§
Sourcefn iterate<F>(self, logic: F) -> VecCollection<G, D, R>where
for<'a> F: FnOnce(Iterative<'a, G, u64>, VecCollection<Iterative<'a, G, u64>, D, R>) -> VecCollection<Iterative<'a, G, u64>, D, R>,
fn iterate<F>(self, logic: F) -> VecCollection<G, D, R>where
for<'a> F: FnOnce(Iterative<'a, G, u64>, VecCollection<Iterative<'a, G, u64>, D, R>) -> VecCollection<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 the closure you supply 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.
The closure is also passed a copy of the inner scope, to facilitate importing external collections.
It can also be acquired by calling .scope() on the closure’s collection argument, but the code
can be awkward to write fluently.
§Examples
use differential_dataflow::input::Input;
use differential_dataflow::operators::Iterate;
::timely::example(|scope| {
scope.new_collection_from(1 .. 10u32).1
.iterate(|_scope, 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.