Skip to main content

create_spinner

Function create_spinner 

Source
pub fn create_spinner(message: &str) -> ProgressBar
Expand description

Creates a spinner for indeterminate operations.

Spinners are used when the total duration or progress cannot be determined, such as waiting for network responses or performing iterative searches.

§Arguments

  • message - Initial status message to display next to the spinner

§Returns

A configured ProgressBar in spinner mode with a green spinner animation.

§Display Format

⠋ Connecting to remote storage...
⠙ Connecting to remote storage...
⠹ Connecting to remote storage...

§Example

let sp = create_spinner("Initializing...");

std::thread::sleep(std::time::Duration::from_millis(100));
sp.set_message("Connecting...");

std::thread::sleep(std::time::Duration::from_millis(100));
sp.finish_with_message("Ready");

§Notes