pub struct ProgressStage { /* private fields */ }Expand description
Describes the current stage of a multi-stage operation.
§Examples
use qubit_progress::ProgressStage;
let stage = ProgressStage::new("verify", "Verify files")
.with_index(2)
.with_total_stages(4)
.with_weight(0.25);
assert_eq!(stage.id(), "verify");
assert_eq!(stage.name(), "Verify files");
assert_eq!(stage.index(), Some(2));Implementations§
Source§impl ProgressStage
impl ProgressStage
Sourcepub const fn with_index(self, index: usize) -> Self
pub const fn with_index(self, index: usize) -> Self
Sourcepub const fn with_total_stages(self, total_stages: usize) -> Self
pub const fn with_total_stages(self, total_stages: usize) -> Self
Sourcepub const fn with_weight(self, weight: f64) -> Self
pub const fn with_weight(self, weight: f64) -> Self
Returns a copy configured with a relative stage weight.
The weight is intended for caller-side weighted progress calculations.
Callers should supply finite, non-negative values. This method records
the supplied value as-is and does not validate NaN, infinity, or
negative input.
§Parameters
weight- Finite, non-negative relative stage weight used by callers that compute weighted total progress.
§Returns
This stage with weight recorded.
Sourcepub const fn index(&self) -> Option<usize>
pub const fn index(&self) -> Option<usize>
Returns the stage index when known.
§Returns
Some(index) when a zero-based stage index was supplied, otherwise
None.
Sourcepub const fn total_stages(&self) -> Option<usize>
pub const fn total_stages(&self) -> Option<usize>
Returns the total stage count when known.
§Returns
Some(total) when a total stage count was supplied, otherwise None.
Trait Implementations§
Source§impl Clone for ProgressStage
impl Clone for ProgressStage
Source§fn clone(&self) -> ProgressStage
fn clone(&self) -> ProgressStage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProgressStage
impl Debug for ProgressStage
Source§impl PartialEq for ProgressStage
impl PartialEq for ProgressStage
Source§fn eq(&self, other: &ProgressStage) -> bool
fn eq(&self, other: &ProgressStage) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ProgressStage
Auto Trait Implementations§
impl Freeze for ProgressStage
impl RefUnwindSafe for ProgressStage
impl Send for ProgressStage
impl Sync for ProgressStage
impl Unpin for ProgressStage
impl UnsafeUnpin for ProgressStage
impl UnwindSafe for ProgressStage
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