pub trait Inspect<G: Scope, C: Container>: InspectCore<G, C> + Sized {
    // Required method
    fn inspect_core<F>(&self, func: F) -> Self
       where F: FnMut(Result<(&G::Timestamp, &[C::Item]), &[G::Timestamp]>) + 'static;

    // Provided methods
    fn inspect(&self, func: impl FnMut(&C::Item) + 'static) -> Self { ... }
    fn inspect_time(
        &self,
        func: impl FnMut(&G::Timestamp, &C::Item) + 'static
    ) -> Self { ... }
    fn inspect_batch(
        &self,
        func: impl FnMut(&G::Timestamp, &[C::Item]) + 'static
    ) -> Self { ... }
}
Expand description

Methods to inspect records and batches of records on a stream.

Required Methods§

source

fn inspect_core<F>(&self, func: F) -> Self
where F: FnMut(Result<(&G::Timestamp, &[C::Item]), &[G::Timestamp]>) + 'static,

Runs a supplied closure on each observed data batch, 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, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .inspect_core(|event| {
               match event {
                   Ok((time, data)) => println!("seen at: {:?}\t{:?} records", time, data.len()),
                   Err(frontier) => println!("frontier advanced to {:?}", frontier),
               }
            });
});

Provided Methods§

source

fn inspect(&self, func: impl FnMut(&C::Item) + 'static) -> Self

Runs a supplied closure on each observed data element.

Examples
use timely::dataflow::operators::{ToStream, Map, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .inspect(|x| println!("seen: {:?}", x));
});
source

fn inspect_time( &self, func: impl FnMut(&G::Timestamp, &C::Item) + 'static ) -> Self

Runs a supplied closure on each observed data element and associated time.

Examples
use timely::dataflow::operators::{ToStream, Map, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .inspect_time(|t, x| println!("seen at: {:?}\t{:?}", t, x));
});
source

fn inspect_batch( &self, func: impl FnMut(&G::Timestamp, &[C::Item]) + 'static ) -> Self

Runs a supplied closure on each observed data batch (time and data slice).

Examples
use timely::dataflow::operators::{ToStream, Map, Inspect};

timely::example(|scope| {
    (0..10).to_stream(scope)
           .inspect_batch(|t,xs| println!("seen at: {:?}\t{:?} records", t, xs.len()));
});

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<G: Scope, C> Inspect<G, Rc<C>> for StreamCore<G, Rc<C>>
where C: AsRef<[C::Item]> + Container,

source§

impl<G: Scope, D: Data + Columnation> Inspect<G, TimelyStack<D>> for StreamCore<G, TimelyStack<D>>

source§

impl<G: Scope, D: Data> Inspect<G, Vec<D>> for StreamCore<G, Vec<D>>