Spinners - 🛎 60+ Elegant terminal spinners for Rust

Hello !

I'm would like to also announce a small but useful library, it's called Spinners and exposes 60+ elegant spinners (it's a Rust equivalent to NodeJS cli-spinners).

Usage

extern crate spinners;

use spinners::{Spinner, Spinners};
use std::thread::sleep;
use std::time::Duration;

fn main() {
    let sp = Spinner::new(Spinners::Dots9, "Waiting for 3 seconds".into());
    sleep(Duration::from_secs(3));
    sp.stop();
}
14 Likes

Oh that's really cute :stuck_out_tongue:

I absolutely have to use the shark one in a project sometimes :shark:

1 Like

@killercup should see this :smiley:

1 Like

Sweet mother of loading indicators I love it

3 Likes

Note this uses the Spinner API provided by the spinner crate. ISTM the purpose of this crate is to use codegen to create rust spinner versions of the spinners from cli-spinners. I think it would have been nice to just expose that data more directly so that consumers can make spinner::SpinnerHandles or SpinnerBuilders, rather than having a wrapper type that limits the options even further.

(alternatively a helper function could have been provided to make those types from spinner. Though that would have made spinner a public dep, and as such the crate would have had to remain < 1.0 in that case)

I looked at spinner and it seems useful for small scripts, but to me, any unconditional print! in a library which cannot be replaced with a user-defined callback is a red flag, because many scripts and applications reserve stdout as an output file. (but this can be easily fixed; hurrah for open source!)

3 Likes