pub trait Map<S: Scope, D: 'static>: Sized {
// Required methods
fn map_in_place<L: FnMut(&mut D) + 'static>(
self,
logic: L,
) -> StreamVec<S, D>;
fn flat_map<I: IntoIterator, L: FnMut(D) -> I + 'static>(
self,
logic: L,
) -> StreamVec<S, I::Item>
where I::Item: 'static;
// Provided method
fn map<D2: 'static, L: FnMut(D) -> D2 + 'static>(
self,
logic: L,
) -> StreamVec<S, D2> { ... }
}Expand description
Extension trait for StreamVec.
Required Methods§
Sourcefn map_in_place<L: FnMut(&mut D) + 'static>(self, logic: L) -> StreamVec<S, D>
fn map_in_place<L: FnMut(&mut D) + 'static>(self, logic: L) -> StreamVec<S, D>
Updates each element of the stream and yields the element, re-using memory where possible.
§Examples
use timely::dataflow::operators::{ToStream, Inspect, vec::Map};
timely::example(|scope| {
(0..10).to_stream(scope)
.map_in_place(|x| *x += 1)
.inspect(|x| println!("seen: {:?}", x));
});Sourcefn flat_map<I: IntoIterator, L: FnMut(D) -> I + 'static>(
self,
logic: L,
) -> StreamVec<S, I::Item>where
I::Item: 'static,
fn flat_map<I: IntoIterator, L: FnMut(D) -> I + 'static>(
self,
logic: L,
) -> StreamVec<S, I::Item>where
I::Item: 'static,
Consumes each element of the stream and yields some number of new elements.
§Examples
use timely::dataflow::operators::{ToStream, Inspect, vec::Map};
timely::example(|scope| {
(0..10).to_stream(scope)
.flat_map(|x| (0..x))
.inspect(|x| println!("seen: {:?}", x));
});Provided Methods§
Sourcefn map<D2: 'static, L: FnMut(D) -> D2 + 'static>(
self,
logic: L,
) -> StreamVec<S, D2>
fn map<D2: 'static, L: FnMut(D) -> D2 + 'static>( self, logic: L, ) -> StreamVec<S, D2>
Consumes each element of the stream and yields a new element.
§Examples
use timely::dataflow::operators::{ToStream, Inspect, vec::Map};
timely::example(|scope| {
(0..10).to_stream(scope)
.map(|x| x + 1)
.inspect(|x| println!("seen: {:?}", x));
});Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.