pub trait Exchange<D> {
// Required method
fn exchange(&self, route: impl FnMut(&D) -> u64 + 'static) -> Self;
}
Expand description
Exchange records between workers.
Required Methods§
Sourcefn exchange(&self, route: impl FnMut(&D) -> u64 + 'static) -> Self
fn exchange(&self, route: impl FnMut(&D) -> u64 + 'static) -> Self
Exchange records between workers.
The closure supplied should map a reference to a record to a u64
,
whose value determines to which worker the record will be routed.
§Examples
use timely::dataflow::operators::{ToStream, Exchange, Inspect};
timely::example(|scope| {
(0..10).to_stream(scope)
.exchange(|x| *x)
.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.