Trait timely::dataflow::operators::core::map::Map

source ·
pub trait Map<S: Scope, C: Container> {
    // Required method
    fn flat_map<C2, I, L>(&self, logic: L) -> StreamCore<S, C2>
       where C2: PushContainer,
             I: IntoIterator,
             I::Item: PushInto<C2>,
             L: FnMut(C::Item<'_>) -> I + 'static;

    // Provided method
    fn map<C2, D2, L>(&self, logic: L) -> StreamCore<S, C2>
       where C2: PushContainer,
             D2: PushInto<C2>,
             L: FnMut(C::Item<'_>) -> D2 + 'static { ... }
}
Expand description

Extension trait for Stream.

Required Methods§

source

fn flat_map<C2, I, L>(&self, logic: L) -> StreamCore<S, C2>
where C2: PushContainer, I: IntoIterator, I::Item: PushInto<C2>, L: FnMut(C::Item<'_>) -> I + 'static,

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

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

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

Provided Methods§

source

fn map<C2, D2, L>(&self, logic: L) -> StreamCore<S, C2>
where C2: PushContainer, D2: PushInto<C2>, L: FnMut(C::Item<'_>) -> D2 + 'static,

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

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

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S: Scope, C: Container> Map<S, C> for StreamCore<S, C>