pub trait LoopVariable<'a, G: Scope, T: Timestamp> {
// Required method
fn loop_variable<D: Container>(
&mut self,
summary: T::Summary
) -> (HandleCore<Iterative<'a, G, T>, D>, StreamCore<Iterative<'a, G, T>, D>);
}
Expand description
Creates a Stream
and a Handle
to later bind the source of that Stream
.
Required Methods§
sourcefn loop_variable<D: Container>(
&mut self,
summary: T::Summary
) -> (HandleCore<Iterative<'a, G, T>, D>, StreamCore<Iterative<'a, G, T>, D>)
fn loop_variable<D: Container>( &mut self, summary: T::Summary ) -> (HandleCore<Iterative<'a, G, T>, D>, StreamCore<Iterative<'a, G, T>, D>)
Creates a Stream
and a Handle
to later bind the source of that Stream
.
The resulting Stream
will have its data defined by a future call to connect_loop
with
its Handle
passed as an argument. Data passed through the stream will have their
timestamps advanced by summary
.
§Examples
use timely::dataflow::Scope;
use timely::dataflow::operators::{LoopVariable, ConnectLoop, ToStream, Concat, Inspect, BranchWhen};
timely::example(|scope| {
// circulate 0..10 for 100 iterations.
scope.iterative::<usize,_,_>(|inner| {
let (handle, cycle) = inner.loop_variable(1);
(0..10).to_stream(inner)
.concat(&cycle)
.inspect(|x| println!("seen: {:?}", x))
.branch_when(|t| t.inner < 100).1
.connect_loop(handle);
});
});
Object Safety§
This trait is not object safe.