multi-spinner 0.1.0

A simple multi-threaded spinner for the terminal
Documentation
  • Coverage
  • 50%
    9 out of 18 items documented1 out of 13 items with examples
  • Size
  • Source code size: 18.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.31 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • rtc11/multi-spinner
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rtc11

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