Trait differential_dataflow::operators::group::Count [] [src]

pub trait Count<G: Scope, K: Data, R: Diff> where
    G::Timestamp: Lattice + Ord
{ fn count(&self) -> Collection<G, (K, R), isize>;
fn count_u(&self) -> Collection<G, (K, R), isize>
    where
        K: Unsigned + Copy
; }

Extension trait for the count differential dataflow method.

Required Methods

Counts the number of occurrences of each element.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Count;

fn main() {
    ::timely::example(|scope| {
        // report the number of occurrences of each key
        scope.new_collection_from(1 .. 10).1
             .map(|x| x / 3)
             .count();
    });
}

Counts the number of occurrences of each element.

This method is a specialization for when the key is an unsigned integer fit for distributing the data.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Count;

fn main() {
    ::timely::example(|scope| {
        // report the number of occurrences of each key
        scope.new_collection_from(1 .. 10u32).1
             .map(|x| x / 3)
             .count_u();
    });
}

Implementors