pub struct ProgressStack { /* private fields */ }Expand description
A thread-safe, shared-clonable collection of Progress instances.
ProgressStack is designed to manage a dynamic list of progress indicators
(bars, spinners, etc.) that typically render together (e.g., a multi-bar CLI).
§Concurrency
This struct uses internal synchronization (via Arc and RwLock), making it
safe to clone and share across threads. Cloning is cheap (pointer copy), and
mutations on one clone are visible to all others.
Implementations§
Source§impl ProgressStack
impl ProgressStack
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty ProgressStack.
§Examples
use atomic_progress::ProgressStack;
let stack = ProgressStack::new();
assert!(stack.is_empty());Sourcepub fn add_pb(
&self,
name: impl Into<CompactString>,
total: impl Into<u64>,
) -> Progress
pub fn add_pb( &self, name: impl Into<CompactString>, total: impl Into<u64>, ) -> Progress
Creates a new progress bar, adds it to the stack, and returns the handle.
This is a shorthand for creating a Progress via Progress::new_pb
and calling push.
§Parameters
name: The display name for the bar.total: The total count for the bar.
Sourcepub fn add_spinner(&self, name: impl Into<CompactString>) -> Progress
pub fn add_spinner(&self, name: impl Into<CompactString>) -> Progress
Creates a new spinner, adds it to the stack, and returns the handle.
This is a shorthand for creating a Progress via Progress::new_spinner
and calling push.
§Parameters
name: The display name for the spinner.
Sourcepub fn snapshot(&self) -> ProgressStackSnapshot
pub fn snapshot(&self) -> ProgressStackSnapshot
Returns a snapshot of the state of all tracked progress instances.
This aggregates the current state of every progress bar in the stack. It is typically used by renderers to draw the current UI frame.
§Performance
This acquires a read lock on the stack collection, and subsequently
acquires read locks on each individual Progress state to copy their data.
Sourcepub fn is_all_finished(&self) -> bool
pub fn is_all_finished(&self) -> bool
Checks if all progress instances in the stack are marked as finished.
Returns true if the stack is empty or if is_finished() returns true
for every item.
Trait Implementations§
Source§impl Clone for ProgressStack
impl Clone for ProgressStack
Source§fn clone(&self) -> ProgressStack
fn clone(&self) -> ProgressStack
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more