pub struct FlatMapOperator<D, I> where
D: Data + for<'a> Deserialize<'a>,
I: IntoIterator,
I::Item: Data + for<'a> Deserialize<'a>, { /* private fields */ }
Expand description
Maps an incoming stream of type D to a stream of type I::Item
using the provided
function.
Example
The below example shows how to use a FlatMapOperator
to double an incoming stream of usize
messages, and return them.
let map_stream = erdos::connect_one_in_one_out(
|| -> FlatMapOperator<usize, _> {
FlatMapOperator::new(|x: &usize| -> Vec<usize> { vec![2 * x] })
},
|| {},
OperatorConfig::new().name("FlatMapOperator"),
&source_stream,
);
Implementations
sourceimpl<D, I> FlatMapOperator<D, I> where
D: Data + for<'a> Deserialize<'a>,
I: IntoIterator,
I::Item: Data + for<'a> Deserialize<'a>,
impl<D, I> FlatMapOperator<D, I> where
D: Data + for<'a> Deserialize<'a>,
I: IntoIterator,
I::Item: Data + for<'a> Deserialize<'a>,
Trait Implementations
sourceimpl<D, I> OneInOneOut<(), D, <I as IntoIterator>::Item> for FlatMapOperator<D, I> where
D: Data + for<'a> Deserialize<'a>,
I: IntoIterator,
I::Item: Data + for<'a> Deserialize<'a>,
impl<D, I> OneInOneOut<(), D, <I as IntoIterator>::Item> for FlatMapOperator<D, I> where
D: Data + for<'a> Deserialize<'a>,
I: IntoIterator,
I::Item: Data + for<'a> Deserialize<'a>,
fn on_data(&mut self, ctx: &mut OneInOneOutContext<'_, (), I::Item>, data: &D)
fn on_watermark(&mut self, _ctx: &mut OneInOneOutContext<'_, (), I::Item>)
fn setup(&mut self, setup_context: &mut SetupContext<S>)
fn run(
&mut self,
config: &OperatorConfig,
read_stream: &mut ReadStream<T>,
write_stream: &mut WriteStream<U>
)
fn destroy(&mut self)
Auto Trait Implementations
impl<D, I> !RefUnwindSafe for FlatMapOperator<D, I>
impl<D, I> Send for FlatMapOperator<D, I>
impl<D, I> Sync for FlatMapOperator<D, I>
impl<D, I> Unpin for FlatMapOperator<D, I>
impl<D, I> !UnwindSafe for FlatMapOperator<D, I>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more