ProgressUtils

Struct ProgressUtils 

Source
pub struct ProgressUtils;
Expand description

Progress utilities for enhancing user experience during operations

Provides themed progress indicators, spinners, and progress bars that integrate with Terminal Jarvis’s theming system. Designed to make cold starts and long-running operations feel more responsive and professional.

All progress indicators respect the user’s theme configuration and provide consistent visual feedback across different Terminal Jarvis operations.

Implementations§

Source§

impl ProgressUtils

Source

pub fn spinner(message: &str) -> ProgressBar

Creates a themed spinner for indeterminate progress operations

Displays an animated spinner with the specified message, using Terminal Jarvis theme colors for consistency. Ideal for operations where progress cannot be measured (e.g., network requests, tool initialization).

§Arguments
  • message - The message to display alongside the spinner
§Returns

A configured ProgressBar in spinner mode

§Example
let spinner = ProgressUtils::spinner("Initializing tool...");
// Perform long operation
spinner.finish_with_message("Tool ready!");
Source

pub fn progress_bar(total: u64, message: &str) -> ProgressBar

Creates a themed progress bar for determinate progress operations

Displays a progress bar with percentage and ETA, using Terminal Jarvis theme colors. Ideal for operations where total progress can be measured (e.g., file downloads, batch processing).

§Arguments
  • total - The total number of steps for the progress bar
  • message - The message to display alongside the progress bar
§Returns

A configured ProgressBar with the specified total and message

§Example
let pb = ProgressUtils::progress_bar(100, "Processing items...");
for i in 0..100 {
    pb.inc(1);
    // Perform work
}
pb.finish();
Source

pub fn multi_progress() -> MultiProgress

Creates a multi-progress manager for concurrent operations

Enables multiple progress indicators to run simultaneously without interfering with each other’s display. Useful for batch operations or parallel task execution.

§Returns

A MultiProgress instance for managing multiple progress indicators

§Example
let multi = ProgressUtils::multi_progress();
let pb1 = multi.add(ProgressBar::new(100));
let pb2 = multi.add(ProgressBar::new(50));
// Run concurrent operations
Source

pub fn finish_with_success(pb: &ProgressBar, message: &str)

Completes progress indicator with a success message

Displays a success message and provides visual feedback that the operation completed successfully. Includes a brief pause to ensure visibility.

§Arguments
  • pb - The ProgressBar to complete
  • message - Success message to display
§Example
let spinner = ProgressUtils::spinner("Installing tool...");
// Perform installation
ProgressUtils::finish_with_success(&spinner, "Tool installed successfully!");
Source

pub fn finish_with_error(pb: &ProgressBar, message: &str)

Completes progress indicator with an error message

Displays an error message and provides visual feedback that the operation failed. Includes a brief pause to ensure visibility.

§Arguments
  • pb - The ProgressBar to complete
  • message - Error message to display
§Example
let spinner = ProgressUtils::spinner("Connecting to service...");
// Attempt connection
if connection_failed {
    ProgressUtils::finish_with_error(&spinner, "Connection failed");
}
Source

pub async fn simulate_installation_progress(pb: &ProgressBar, tool_name: &str)

Simulate installation progress with realistic steps

Source

pub async fn simulate_verification_progress(pb: &ProgressBar, tool_name: &str)

Simulate tool verification progress

Source

pub async fn quick_load(message: &str, duration_ms: u64) -> ProgressBar

Show a quick loading animation for brief operations

Source

pub fn info_message(message: &str)

Create a styled info message

Source

pub fn warning_message(message: &str)

Create a styled warning message

Source

pub fn error_message(message: &str)

Create a styled error message

Source

pub fn success_message(message: &str)

Create a styled success message

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,