Function console_utils::spinner

source ·
pub fn spinner(time: f64, spinner_type: SpinnerType)
Expand description

Displays a console-based spinner animation.

Parameters

  • time: A floating-point number representing the duration of the spinner animation in seconds.
  • spinner_type: The type of spinner to display, which can be one of the following:
    • SpinnerType::Standard: Standard spinner with characters / - \ |.
    • SpinnerType::Dots: Spinner with dots . .. … …..
    • SpinnerType::Box: Spinner with box characters ▌ ▀ ▐ ▄.
    • SpinnerType::Flip: Spinner with flip characters _ _ _ - \ ’ ´ - _ _ _.
    • SpinnerType::Custom(frame): Custom spinner with a user-defined frame.

Example

use console_utils::{spinner, SpinnerType};

// Display a standard spinner for 3 seconds
spinner(3.0, SpinnerType::Standard);

// Display a custom spinner for 2 seconds
spinner(2.0, SpinnerType::Custom(vec!["1", "2", "3", "4", "3", "2"]));