Skip to main content

ProgressSink

Trait ProgressSink 

Source
pub trait ProgressSink {
    // Provided methods
    fn start(&mut self, label: &str, total: Option<u64>) { ... }
    fn inc(&mut self, units: u64) { ... }
    fn set(&mut self, current: u64) { ... }
    fn message(&mut self, msg: &str) { ... }
    fn finish(&mut self) { ... }
}
Expand description

A sink for progress updates emitted by a library operation.

Every method has a no-op default, so a sink implements only what it needs. The library calls these; it never decides whether output is a tty, what colour to use, or how often to redraw — that is the CLI’s responsibility.

Provided Methods§

Source

fn start(&mut self, label: &str, total: Option<u64>)

Begin a new progress phase labelled label, optionally with a known total count of units (e.g. objects). None means the total is unknown.

Source

fn inc(&mut self, units: u64)

Advance the current phase by units.

Source

fn set(&mut self, current: u64)

Set the absolute progress of the current phase to current units.

Source

fn message(&mut self, msg: &str)

Emit an out-of-band human-readable message (e.g. a remote sideband line or "Trying merge strategy ...").

Source

fn finish(&mut self)

Finish the current phase.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: ProgressSink + ?Sized> ProgressSink for &mut T

Forwarding impl so a &mut P can be threaded into sub-operations that also take impl ProgressSink without re-borrowing gymnastics at every call site.

Source§

fn start(&mut self, label: &str, total: Option<u64>)

Source§

fn inc(&mut self, units: u64)

Source§

fn set(&mut self, current: u64)

Source§

fn message(&mut self, msg: &str)

Source§

fn finish(&mut self)

Implementors§