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
impl ProgressUtils
Sourcepub fn spinner(message: &str) -> ProgressBar
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!");Sourcepub fn progress_bar(total: u64, message: &str) -> ProgressBar
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 barmessage- 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();Sourcepub fn multi_progress() -> MultiProgress
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 operationsSourcepub fn finish_with_success(pb: &ProgressBar, message: &str)
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 completemessage- Success message to display
§Example
let spinner = ProgressUtils::spinner("Installing tool...");
// Perform installation
ProgressUtils::finish_with_success(&spinner, "Tool installed successfully!");Sourcepub fn finish_with_error(pb: &ProgressBar, message: &str)
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 completemessage- Error message to display
§Example
let spinner = ProgressUtils::spinner("Connecting to service...");
// Attempt connection
if connection_failed {
ProgressUtils::finish_with_error(&spinner, "Connection failed");
}Sourcepub async fn simulate_installation_progress(pb: &ProgressBar, tool_name: &str)
pub async fn simulate_installation_progress(pb: &ProgressBar, tool_name: &str)
Simulate installation progress with realistic steps
Sourcepub async fn simulate_verification_progress(pb: &ProgressBar, tool_name: &str)
pub async fn simulate_verification_progress(pb: &ProgressBar, tool_name: &str)
Simulate tool verification progress
Sourcepub async fn quick_load(message: &str, duration_ms: u64) -> ProgressBar
pub async fn quick_load(message: &str, duration_ms: u64) -> ProgressBar
Show a quick loading animation for brief operations
Sourcepub fn info_message(message: &str)
pub fn info_message(message: &str)
Create a styled info message
Sourcepub fn warning_message(message: &str)
pub fn warning_message(message: &str)
Create a styled warning message
Sourcepub fn error_message(message: &str)
pub fn error_message(message: &str)
Create a styled error message
Sourcepub fn success_message(message: &str)
pub fn success_message(message: &str)
Create a styled success message