timely::dataflow::operators::core::feedback

Trait LoopVariable

Source
pub trait LoopVariable<'a, G: Scope, T: Timestamp> {
    // Required method
    fn loop_variable<C: Container + Data>(
        &mut self,
        summary: T::Summary,
    ) -> (Handle<Iterative<'a, G, T>, C>, StreamCore<Iterative<'a, G, T>, C>);
}
Expand description

Creates a StreamCore and a Handle to later bind the source of that StreamCore.

Required Methods§

Source

fn loop_variable<C: Container + Data>( &mut self, summary: T::Summary, ) -> (Handle<Iterative<'a, G, T>, C>, StreamCore<Iterative<'a, G, T>, C>)

Creates a StreamCore and a Handle to later bind the source of that StreamCore.

The resulting StreamCore will have its data defined by a future call to connect_loop with its Handle passed as an argument. Containers 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);
    });
});

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.

Implementors§

Source§

impl<'a, G: Scope, T: Timestamp> LoopVariable<'a, G, T> for Iterative<'a, G, T>