pub trait Partition<G: Scope, D: 'static> {
// Required method
fn partition<D2: 'static, F: Fn(D) -> (u64, D2) + 'static>(
self,
parts: u64,
route: F,
) -> Vec<StreamVec<G, D2>> ⓘ;
}Expand description
Partition a stream of records into multiple streams.
Required Methods§
Sourcefn partition<D2: 'static, F: Fn(D) -> (u64, D2) + 'static>(
self,
parts: u64,
route: F,
) -> Vec<StreamVec<G, D2>> ⓘ
fn partition<D2: 'static, F: Fn(D) -> (u64, D2) + 'static>( self, parts: u64, route: F, ) -> Vec<StreamVec<G, D2>> ⓘ
Produces parts output streams, containing records produced and assigned by route.
§Examples
use timely::dataflow::operators::{ToStream, Inspect, vec::Partition};
timely::example(|scope| {
let mut streams = (0..10).to_stream(scope)
.partition(3, |x| (x % 3, x));
streams.pop().unwrap().inspect(|x| println!("seen 2: {:?}", x));
streams.pop().unwrap().inspect(|x| println!("seen 1: {:?}", x));
streams.pop().unwrap().inspect(|x| println!("seen 0: {:?}", 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.