Skip to main content

Observer

Trait Observer 

Source
pub trait Observer {
    // Provided methods
    fn progress(&mut self, _done: usize, _total: usize) { ... }
    fn output(&mut self, _name: &'static str, _volume: VolumeRef<'_>) { ... }
}
Expand description

Receives a stage’s progress and its intermediate outputs as they are produced.

Both methods default to doing nothing, so an implementation overrides only what it uses.

Provided Methods§

Source

fn progress(&mut self, _done: usize, _total: usize)

Step done of total has started.

Source

fn output(&mut self, _name: &'static str, _volume: VolumeRef<'_>)

An intermediate output named name is ready. The stage documents its names; the slice is only valid for the duration of the call.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Observer for ()

Ignores progress and outputs.

Implementors§

Source§

impl<F: FnMut(usize, usize)> Observer for F

A progress callback is an observer that ignores intermediate outputs.