Skip to main content

Progress

Struct Progress 

Source
pub struct Progress<'reporter> { /* private fields */ }
Expand description

One started progress operation.

Terminal methods consume this value, preventing reports after a terminal phase and preventing duplicate terminal events in safe Rust.

Implementations§

Source§

impl<'reporter> Progress<'reporter>

Source

pub fn builder(reporter: &'reporter dyn Reporter) -> ProgressBuilder<'reporter>

Creates a builder borrowing one reporter.

Source

pub fn builder_arc(reporter: Arc<dyn Reporter>) -> ProgressBuilder<'static>

Creates a builder that owns one shared reporter.

Source

pub const fn is_enabled(&self) -> bool

Returns enablement sampled when this operation started.

Source

pub fn elapsed(&self) -> Duration

Returns monotonic elapsed time since start().

Source

pub fn metric(&self, metric_id: &str) -> Option<MetricHandle>

Returns a cloneable live metric selected by its stable ID.

Source

pub fn report(&mut self) -> Result<(), EmissionError>

Immediately emits a Running event from current metric state.

Source

pub fn report_if_due(&mut self) -> Result<(), EmissionError>

Emits a Running event only when the configured interval is due.

Source

pub fn set_stage(&mut self, stage: Stage) -> Result<(), ConfigurationError>

Replaces stage metadata attached to subsequent events.

Source

pub fn clear_stage(&mut self)

Removes stage metadata from subsequent events.

Source

pub fn finish_unchecked(self) -> Result<Duration, TerminalError>

Consumes this operation and emits a successful terminal event without checking whether metric work is complete.

Source

pub fn finish(self) -> Result<Duration, FinishError>

Consumes this operation and emits a successful terminal event only when no metric has active work and every known total has been completed.

Source

pub fn finish_recoverable( self, ) -> Result<Duration, RecoverableFinishError<'reporter>>

Consumes this operation and emits a successful terminal event while preserving the operation when completion validation fails.

Source

pub fn fail(self) -> Result<Duration, TerminalError>

Consumes this operation and emits a failed terminal event.

Source

pub fn cancel(self) -> Result<Duration, TerminalError>

Consumes this operation and emits a cancelled terminal event.

Source

pub fn spawn_auto_reporter<'scope, 'env>( &'scope mut self, scope: &'scope Scope<'scope, 'env>, ) -> AutoReporter<'scope, 'reporter>
where 'reporter: 'scope,

Spawns a scoped automatic Running reporter that exclusively borrows this operation.

Trait Implementations§

Source§

impl Drop for Progress<'_>

Source§

fn drop(&mut self)

Closes live handles when a caller abandons an unfinished operation.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'reporter> !RefUnwindSafe for Progress<'reporter>

§

impl<'reporter> !UnwindSafe for Progress<'reporter>

§

impl<'reporter> Freeze for Progress<'reporter>

§

impl<'reporter> Send for Progress<'reporter>

§

impl<'reporter> Sync for Progress<'reporter>

§

impl<'reporter> Unpin for Progress<'reporter>

§

impl<'reporter> UnsafeUnpin for Progress<'reporter>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.