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>
impl<'reporter> Progress<'reporter>
Sourcepub fn builder(reporter: &'reporter dyn Reporter) -> ProgressBuilder<'reporter>
pub fn builder(reporter: &'reporter dyn Reporter) -> ProgressBuilder<'reporter>
Creates a builder borrowing one reporter.
Sourcepub fn builder_arc(reporter: Arc<dyn Reporter>) -> ProgressBuilder<'static>
pub fn builder_arc(reporter: Arc<dyn Reporter>) -> ProgressBuilder<'static>
Creates a builder that owns one shared reporter.
Sourcepub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Returns enablement sampled when this operation started.
Sourcepub fn metric(&self, metric_id: &str) -> Option<MetricHandle>
pub fn metric(&self, metric_id: &str) -> Option<MetricHandle>
Returns a cloneable live metric selected by its stable ID.
Sourcepub fn report(&mut self) -> Result<(), EmissionError>
pub fn report(&mut self) -> Result<(), EmissionError>
Immediately emits a Running event from current metric state.
Sourcepub fn report_if_due(&mut self) -> Result<(), EmissionError>
pub fn report_if_due(&mut self) -> Result<(), EmissionError>
Emits a Running event only when the configured interval is due.
Sourcepub fn set_stage(&mut self, stage: Stage) -> Result<(), ConfigurationError>
pub fn set_stage(&mut self, stage: Stage) -> Result<(), ConfigurationError>
Replaces stage metadata attached to subsequent events.
Sourcepub fn clear_stage(&mut self)
pub fn clear_stage(&mut self)
Removes stage metadata from subsequent events.
Sourcepub fn finish_unchecked(self) -> Result<Duration, TerminalError>
pub fn finish_unchecked(self) -> Result<Duration, TerminalError>
Consumes this operation and emits a successful terminal event without checking whether metric work is complete.
Sourcepub fn finish(self) -> Result<Duration, FinishError>
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.
Sourcepub fn finish_recoverable(
self,
) -> Result<Duration, RecoverableFinishError<'reporter>>
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.
Sourcepub fn fail(self) -> Result<Duration, TerminalError>
pub fn fail(self) -> Result<Duration, TerminalError>
Consumes this operation and emits a failed terminal event.
Sourcepub fn cancel(self) -> Result<Duration, TerminalError>
pub fn cancel(self) -> Result<Duration, TerminalError>
Consumes this operation and emits a cancelled terminal event.
Sourcepub fn spawn_auto_reporter<'scope, 'env>(
&'scope mut self,
scope: &'scope Scope<'scope, 'env>,
) -> AutoReporter<'scope, 'reporter>where
'reporter: 'scope,
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.