Skip to main content

ProgressMetricSnapshot

Struct ProgressMetricSnapshot 

Source
pub struct ProgressMetricSnapshot { /* private fields */ }
Expand description

Snapshot of one metric counter within a progress event.

A progress event may carry multiple counters using different metric units, such as entries and bytes. ProgressMetricSnapshot flattens one counter together with the event-level phase, stage, and elapsed time so formatters and consumers can handle one metric record at a time.

Implementations§

Source§

impl ProgressMetricSnapshot

Source

pub fn new( metric: ProgressMetric, phase: ProgressPhase, stage: Option<ProgressStage>, counter: &ProgressCounter, elapsed: Duration, ) -> Self

Creates a metric snapshot from explicit values.

§Parameters
  • metric - Complete metric metadata.
  • phase - Lifecycle phase inherited from the source event.
  • stage - Optional stage inherited from the source event.
  • counter - Counter values copied into the snapshot.
  • elapsed - Elapsed duration inherited from the source event.
§Returns

A flattened metric snapshot.

Source

pub const fn metric(&self) -> &ProgressMetric

Returns the complete metric metadata.

§Returns

The metric metadata associated with this snapshot.

Source

pub fn metric_id(&self) -> &str

Returns the stable metric id.

§Returns

The metric id associated with this snapshot.

Source

pub fn metric_name(&self) -> &str

Returns the human-readable metric name.

§Returns

The metric display name associated with this snapshot.

Source

pub const fn phase(&self) -> ProgressPhase

Returns the lifecycle phase.

§Returns

The phase inherited from the source event.

Source

pub const fn stage(&self) -> Option<&ProgressStage>

Returns the optional stage.

§Returns

Some(stage) when the source event carried stage metadata, otherwise None.

Source

pub const fn total_count(&self) -> Option<u64>

Returns the total work-unit count when known.

§Returns

Some(total) for known-total progress, or None for open-ended progress.

Source

pub const fn completed_count(&self) -> u64

Returns the completed work-unit count.

§Returns

The number of completed work units.

Source

pub const fn active_count(&self) -> u64

Returns the active work-unit count.

§Returns

The number of currently active work units.

Source

pub const fn succeeded_count(&self) -> u64

Returns the successful work-unit count.

§Returns

The number of successful work units.

Source

pub const fn failed_count(&self) -> u64

Returns the failed work-unit count.

§Returns

The number of failed work units.

Source

pub const fn remaining_count(&self) -> Option<u64>

Returns the remaining work-unit count when the total is known.

§Returns

Some(total - completed - active) using saturating arithmetic for known-total progress, or None when the total is unknown.

Source

pub fn progress_fraction(&self) -> Option<f64>

Returns completed progress as a fraction in 0.0..=1.0.

§Returns

Some(fraction) for known-total progress, Some(1.0) when the known total is zero, or None when the total is unknown.

Source

pub fn progress_percent(&self) -> Option<f64>

Returns completed progress as a percentage in 0.0..=100.0.

§Returns

Some(percent) for known-total progress, or None when the total is unknown.

Source

pub const fn elapsed(&self) -> Duration

Returns the elapsed duration.

§Returns

The elapsed duration inherited from the source event.

Trait Implementations§

Source§

impl Clone for ProgressMetricSnapshot

Source§

fn clone(&self) -> ProgressMetricSnapshot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProgressMetricSnapshot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProgressMetricSnapshot

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ProgressMetricSnapshot

Source§

fn eq(&self, other: &ProgressMetricSnapshot) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ProgressMetricSnapshot

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ProgressMetricSnapshot

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,