pub trait InspectCore<G: Scope, C: Container> {
// Required method
fn inspect_container<F>(&self, func: F) -> StreamCore<G, C>
where F: FnMut(Result<(&G::Timestamp, &C), &[G::Timestamp]>) + 'static;
}
Expand description
Inspect containers
Required Methods§
sourcefn inspect_container<F>(&self, func: F) -> StreamCore<G, C>
fn inspect_container<F>(&self, func: F) -> StreamCore<G, C>
Runs a supplied closure on each observed container, and each frontier advancement.
Rust’s Result
type is used to distinguish the events, with Ok
for time and data,
and Err
for frontiers. Frontiers are only presented when they change.
Examples
use timely::dataflow::operators::{ToStream, Map, InspectCore};
timely::example(|scope| {
(0..10).to_stream(scope)
.inspect_container(|event| {
match event {
Ok((time, data)) => println!("seen at: {:?}\t{:?} records", time, data.len()),
Err(frontier) => println!("frontier advanced to {:?}", frontier),
}
});
});
Object Safety§
This trait is not object safe.