pub trait Accumulate<G: Scope, D: Data> {
    fn accumulate<A: Data>(
        &self,
        default: A,
        logic: impl Fn(&mut A, RefOrMut<'_, Vec<D>>) + 'static
    ) -> Stream<G, A>; fn count(&self) -> Stream<G, usize> { ... } }
Expand description

Accumulates records within a timestamp.

Required Methods

Accumulates records within a timestamp.

Examples
use timely::dataflow::operators::{ToStream, Accumulate, Capture};
use timely::dataflow::operators::capture::Extract;

let captured = timely::example(|scope| {
    (0..10).to_stream(scope)
           .accumulate(0, |sum, data| { for &x in data.iter() { *sum += x; } })
           .capture()
});

let extracted = captured.extract();
assert_eq!(extracted, vec![(0, vec![45])]);

Provided Methods

Counts the number of records observed at each time.

Examples
use timely::dataflow::operators::{ToStream, Accumulate, Capture};
use timely::dataflow::operators::capture::Extract;

let captured = timely::example(|scope| {
    (0..10).to_stream(scope)
           .count()
           .capture()
});

let extracted = captured.extract();
assert_eq!(extracted, vec![(0, vec![10])]);

Implementors