pub trait Inspect<T: Timestamp, C>: Sized {
// Required method
fn inspect_core<F>(self, func: F) -> Self
where F: FnMut(Result<(&Stamp<T>, &C), &[T]>) + 'static;
// Provided method
fn inspect<F>(self, func: F) -> Self
where for<'a> &'a C: IntoIterator,
F: for<'a> FnMut(<&'a C as IntoIterator>::Item) + 'static { ... }
}Expand description
Methods to inspect records and container and frontier events on a stream.
Required Methods§
Sourcefn inspect_core<F>(self, func: F) -> Self
fn inspect_core<F>(self, func: F) -> Self
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 a container and
the stamp under which it travels, and Err for frontiers. Frontiers are only presented
when they change. The stamp is the set of timestamps under which the container travels:
a singleton unless an upstream operator has stamped its messages with several times, or
with none.
§Examples
use timely::dataflow::operators::{ToStream, Inspect};
timely::example(|scope| {
(0..10).to_stream(scope)
.container::<Vec<_>>()
.inspect_core(|event| {
match event {
Ok((stamp, data)) => println!("seen under {:?}: {:?} records", stamp, data.len()),
Err(frontier) => println!("frontier advanced to {:?}", frontier),
}
});
});Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".