pub struct Metric { /* private fields */ }Expand description
Stable metadata for one metric in a progress operation.
Implementations§
Source§impl Metric
impl Metric
Sourcepub fn new(id: &str, name: &str) -> Self
pub fn new(id: &str, name: &str) -> Self
Creates metric metadata without a known total.
The ID and name are validated when the enclosing progress operation is started, so this constructor never panics.
Sourcepub const fn total(self, total: u64) -> Self
pub const fn total(self, total: u64) -> Self
Records the total work for this metric.
The value is carried automatically by all future events from the operation that owns this metric.
Sourcepub const fn configured_total(&self) -> Option<u64>
pub const fn configured_total(&self) -> Option<u64>
Returns the configured total, if it is known.
Trait Implementations§
impl Eq for Metric
impl StructuralPartialEq for Metric
Auto Trait Implementations§
impl Freeze for Metric
impl RefUnwindSafe for Metric
impl Send for Metric
impl Sync for Metric
impl Unpin for Metric
impl UnsafeUnpin for Metric
impl UnwindSafe for Metric
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more