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 refresh(&mut self)
pub fn refresh(&mut self)
Force a refresh/render of the progress display. In a live display context this triggers a re-render.
Sourcepub fn start_task(&mut self, task_id: usize)
pub fn start_task(&mut self, task_id: usize)
Mark a task as started (reset its start_time to now).
Sourcepub fn reset(&mut self, task_id: usize, total: Option<f64>)
pub fn reset(&mut self, task_id: usize, total: Option<f64>)
Reset a task’s completed count.
If total is Some, also updates the task’s total.
Sourcepub fn get_default_columns(&self) -> Vec<Box<dyn ProgressColumn>>
pub fn get_default_columns(&self) -> Vec<Box<dyn ProgressColumn>>
Get the default column set for rendering.
Returns: description, spinner, bar, percentage, elapsed.
Sourcepub fn get_renderable(&self, task_id: usize) -> Option<&dyn Renderable>
pub fn get_renderable(&self, task_id: usize) -> Option<&dyn Renderable>
Get the renderable for a specific task, if any.
Sourcepub fn get_renderables(&self) -> Vec<&dyn Renderable>
pub fn get_renderables(&self) -> Vec<&dyn Renderable>
Get all task renderables.
Sourcepub fn make_tasks_table(&self, columns: &[Box<dyn ProgressColumn>]) -> Table
pub fn make_tasks_table(&self, columns: &[Box<dyn ProgressColumn>]) -> Table
Build a Table from tasks and progress columns.
Each visible task becomes a row, each column becomes a cell rendered
by the corresponding ProgressColumn.
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: &str,
total: Option<f64>,
) -> TrackIterator<I::IntoIter> ⓘ
pub fn track<I: IntoIterator>( &mut self, sequence: I, description: &str, 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,
description: &str,
total: Option<u64>,
) -> ProgressFile ⓘ
pub fn wrap_file( &mut self, file: File, description: &str, total: Option<u64>, ) -> ProgressFile ⓘ
Wrap an already-open std::fs::File with progress tracking.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Progress
impl !Send for Progress
impl !Sync for Progress
impl !UnwindSafe for Progress
impl Freeze for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more