pub trait Map<S: Scope, C: Container> {
// Required method
fn flat_map<C2, I, L>(&self, logic: L) -> StreamCore<S, C2>
where I: IntoIterator,
C2: SizableContainer + PushInto<I::Item> + Data,
L: FnMut(C::Item<'_>) -> I + 'static;
// Provided method
fn map<C2, D2, L>(&self, logic: L) -> StreamCore<S, C2>
where C2: SizableContainer + PushInto<D2> + Data,
L: FnMut(C::Item<'_>) -> D2 + 'static { ... }
}
Expand description
Extension trait for Stream
.
Required Methods§
sourcefn flat_map<C2, I, L>(&self, logic: L) -> StreamCore<S, C2>where
I: IntoIterator,
C2: SizableContainer + PushInto<I::Item> + Data,
L: FnMut(C::Item<'_>) -> I + 'static,
fn flat_map<C2, I, L>(&self, logic: L) -> StreamCore<S, C2>where
I: IntoIterator,
C2: SizableContainer + PushInto<I::Item> + Data,
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§
sourcefn map<C2, D2, L>(&self, logic: L) -> StreamCore<S, C2>
fn map<C2, D2, L>(&self, logic: L) -> StreamCore<S, C2>
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.