Trait differential_dataflow::input::Input [] [src]

pub trait Input<'a, A: Allocate, T: Timestamp + Ord> {
    fn new_collection<D, R>(
        &mut self
    ) -> (InputSession<T, D, R>, Collection<Child<'a, Root<A>, T>, D, R>)
    where
        D: Data,
        R: Diff
;
fn new_collection_from<I>(
        &mut self,
        data: I
    ) -> (InputSession<T, I::Item, isize>, Collection<Child<'a, Root<A>, T>, I::Item, isize>)
    where
        I: IntoIterator + 'static,
        I::Item: Data
; }

Create a new collection and input handle to control the collection.

Required Methods

Create a new collection and input handle to subsequently control the collection.

Examples

extern crate timely;
extern crate timely_communication;
extern crate differential_dataflow;

use timely_communication::Configuration;
use differential_dataflow::input::Input;

fn main() {
    ::timely::execute(Configuration::Thread, |worker| {

        let (mut handle, probe) = worker.dataflow::<(),_,_>(|scope| {
            // create input handle and collection.
            let (handle, data) = scope.new_collection();
            let probe = data.map(|x| x * 2)
                            .inspect(|x| println!("{:?}", x))
                            .probe();
            (handle, probe)
        });

        handle.insert(1);
        handle.insert(5);

    }).unwrap();
}

Create a new collection and input handle from initial data.

Examples

extern crate timely;
extern crate timely_communication;
extern crate differential_dataflow;

use timely_communication::Configuration;
use differential_dataflow::input::Input;

fn main() {
    ::timely::execute(Configuration::Thread, |worker| {

        let (mut handle, probe) = worker.dataflow::<(),_,_>(|scope| {
            // create input handle and collection.
            let (handle, data) = scope.new_collection_from(0 .. 10);
            let probe = data.map(|x| x * 2)
                            .inspect(|x| println!("{:?}", x))
                            .probe();
            (handle, probe)
        });

        handle.insert(1);
        handle.insert(5);

    }).unwrap();
}

Implementors