multi-spinner

Crates.iomulti-spinner
lib.rsmulti-spinner
version0.1.0
sourcesrc
created_at2024-01-23 14:27:55.278708
updated_at2024-01-23 14:27:55.278708
descriptionA simple multi-threaded spinner for the terminal
homepage
repositoryhttps://github.com/rtc11/multi-spinner/
max_upload_size
id1110871
size11,307
rt (rtc11)

documentation

README

multi-spinner

A simple terminal spinner library that uses a shared stdout.

setup

Smack this into your toml

[dependencies]
multi-spinner = "0.1.0"

Throw this on your code

use std::{thread, time::Duration};
use multi_spinner::{Spinner, spinners::Animation};

fn main() {
    let mut spinner = Spinner::builder()
        .msg("awesome".into())
        .start();

    thread::sleep(Duration::from_secs(3));

    spinner.stop().expect("");
}

If you need full control over stdout, you can create a mutexed arc

    let stdout = Arc::new(Mutex::new(stdout()));

    let mut spinner = Spinner::builder()
        .stdout(stdout)
        .msg("splendid".into())
        .start();

You can if you want to, change the awesome spinner

    let mut spinner = Spinner::builder()
        .spinner(Animation::Bars10(0))
        .build();

    spinner.start() // <-- in case you need to await the start
Commit count: 0

cargo fmt