pub trait ProgressObserver {
// Required methods
fn step_began(&mut self, step: &Step<'_>);
fn step_advanced(&mut self, completed: u64);
fn step_ended(&mut self);
// Provided methods
fn step_total_resolved(&mut self, total: u64) { ... }
fn step_concluded(&mut self, conclusion: &str) { ... }
}Expand description
Receives the steps of a long-running operation.
An operation calls Self::step_began, then Self::step_advanced
zero or more times, then Self::step_ended. Steps are sequential:
implementations need not handle nesting, and both edges are forgiving
so no caller can leave an implementation in a broken state —
step_began while a step is active ends that step first, and
step_ended without an active step does nothing.
Counts passed to step_advanced are cumulative completed items
within the current step, never deltas, and never decrease.
Required Methods§
Sourcefn step_began(&mut self, step: &Step<'_>)
fn step_began(&mut self, step: &Step<'_>)
A new step began.
Sourcefn step_advanced(&mut self, completed: u64)
fn step_advanced(&mut self, completed: u64)
completed items of the current step are done, cumulatively.
Sourcefn step_ended(&mut self)
fn step_ended(&mut self)
The current step finished. An operation that fails mid-step still ends the step before returning its error.
Provided Methods§
Sourcefn step_total_resolved(&mut self, total: u64)
fn step_total_resolved(&mut self, total: u64)
The current step’s total became known after it began. The default implementation ignores it.
Sourcefn step_concluded(&mut self, conclusion: &str)
fn step_concluded(&mut self, conclusion: &str)
The current step’s result, as one short factual clause a renderer
may append to the step’s completion line — for example
"73,967 pre-existing bulk segments (15.0 GiB) will be shared in place and retained". Reported at most once per step, after the
step’s counting is complete and before Self::step_ended. The
default implementation ignores it: a conclusion is a courtesy to
the reader, never something an operation depends on.
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: ProgressObserver + ?Sized> ProgressObserver for &mut Observer
Forwards to a borrowed observer, so &mut dyn ProgressObserver can be
passed on where an impl ProgressObserver is expected.
impl<Observer: ProgressObserver + ?Sized> ProgressObserver for &mut Observer
Forwards to a borrowed observer, so &mut dyn ProgressObserver can be
passed on where an impl ProgressObserver is expected.