pub struct Progress {
pub tasks: Vec<Task>,
pub auto_refresh: bool,
pub refresh_per_second: f64,
pub transient: bool,
pub columns: Option<Vec<Box<dyn ProgressColumn>>>,
/* private fields */
}Expand description
A multi-task progress display.
Fields§
§tasks: Vec<Task>§auto_refresh: bool§refresh_per_second: f64§transient: bool§columns: Option<Vec<Box<dyn ProgressColumn>>>Columns to render for each task (if None, uses default columns).
Implementations§
Source§impl Progress
impl Progress
Sourcepub fn with_columns(self, columns: Vec<Box<dyn ProgressColumn>>) -> Self
pub fn with_columns(self, columns: Vec<Box<dyn ProgressColumn>>) -> Self
Replace the default columns with a custom list of ProgressColumns.
Each task is rendered as one row using the provided columns.
Sourcepub fn add_task(
&mut self,
description: impl Into<String>,
total: Option<f64>,
) -> usize
pub fn add_task( &mut self, description: impl Into<String>, total: Option<f64>, ) -> usize
Register a new task and return its numeric ID (used by advance, update, etc.).
Sourcepub fn advance(&mut self, task_id: usize, delta: f64)
pub fn advance(&mut self, task_id: usize, delta: f64)
Increase a task’s completed count by delta.
Sourcepub fn update(&mut self, task_id: usize, completed: f64)
pub fn update(&mut self, task_id: usize, completed: f64)
Set a task’s completed count directly (overwrites current value).
Sourcepub fn remove_task(&mut self, task_id: usize)
pub fn remove_task(&mut self, task_id: usize)
Remove a task by its ID. No-op if the task does not exist.
Sourcepub fn render(&self, width: usize) -> String
pub fn render(&self, width: usize) -> String
Render all visible tasks to a multi-line string at the given terminal width.
Sourcepub fn track<I: IntoIterator>(
&mut self,
sequence: I,
description: impl Into<String>,
total: Option<f64>,
) -> TrackIterator<I::IntoIter> ⓘ
pub fn track<I: IntoIterator>( &mut self, sequence: I, description: impl Into<String>, total: Option<f64>, ) -> TrackIterator<I::IntoIter> ⓘ
Wrap an iterator with progress tracking, returning a TrackIterator.
Equivalent to Python Rich’s track().
Sourcepub fn advance_bytes(&mut self, task_id: usize, bytes: u64)
pub fn advance_bytes(&mut self, task_id: usize, bytes: u64)
Convenience: advance a task by a u64 byte count (casts to f64 internally).
Sourcepub fn open(
&mut self,
path: impl AsRef<Path>,
description: impl Into<String>,
) -> Result<ProgressFile>
pub fn open( &mut self, path: impl AsRef<Path>, description: impl Into<String>, ) -> Result<ProgressFile>
Open a file at the given path and wrap it with progress tracking.
Returns a ProgressFile whose reads are recorded via this Progress.
Sourcepub fn wrap_file(
&mut self,
file: File,
total: u64,
description: impl Into<String>,
) -> ProgressFile ⓘ
pub fn wrap_file( &mut self, file: File, total: u64, description: impl Into<String>, ) -> ProgressFile ⓘ
Wrap an already-open std::fs::File with progress tracking.