Trait timely::dataflow::operators::map::Map [] [src]

pub trait Map<S: Scope, D: Data> {
    fn map<D2: Data, L: Fn(D) -> D2 + 'static>(&self, logic: L) -> Stream<S, D2>;
fn map_in_place<L: Fn(&mut D) + 'static>(&self, logic: L) -> Stream<S, D>;
fn flat_map<I: IntoIterator, L: Fn(D) -> I + 'static>(
        &self,
        logic: L
    ) -> Stream<S, I::Item>
    where
        I::Item: Data
; }

Extension trait for Stream.

Required Methods

Consumes each element of the stream and yields a new element.

Examples

use timely::dataflow::operators::{ToStream, Map, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .map(|x| x + 1)
           .inspect(|x| println!("seen: {:?}", x));
});

Updates each element of the stream and yields the element, re-using memory where possible.

Examples

use timely::dataflow::operators::{ToStream, Map, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .map_in_place(|x| *x += 1)
           .inspect(|x| println!("seen: {:?}", x));
});

Consumes each element of the stream and yields some number of new elements.

Examples

use timely::dataflow::operators::{ToStream, Map, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .flat_map(|x| (0..x))
           .inspect(|x| println!("seen: {:?}", x));
});

Implementors