Expand description
spinoff
spinoff
is a simple library for displaying spinners in the terminal.
Usage
let mut sp = Spinner::new(spinners::Dots, "Loading...", None);
sleep(Duration::from_millis(800));
sp.success("Success!");
Spinners
This crate provides 80+ spinners out of the box, which you can find in the
spinners
module.
Each spinner provided in this crate is broken up into its own feature. For
example, if you want to use the dots9
spinner, you need to enable the dots9
feature in your Cargo.toml
(the dots
feature is enabled by default).
If you want to use a custom spinner, you can use the spinner!
macro.
let frames = spinner!([">", ">>", ">>>"], 100);
let mut sp = Spinner::new(frames, "Loading...", None);
sleep(Duration::from_millis(800));
sp.success("Success!");
Colors
You can also color your spinners without any hassle. Simply pass a color to the color
option.
There are 9 colors available: blue, green, red, yellow, cyan, white, magenta, black and a custom variant.
Don’t want any of that? Simply pass None
to the color
option.
Note
Currently, the library is designed in a way that doesn’t support using multiple spinners at a time. However, that may change in the future.
Modules
Macros
- Create a new
SpinnerFrames
struct
Structs
- Terminal spinner.
Enums
- Color for spinner. Supports the 8 basic colors and a custom color variant.
- Simplified type for a stream. By default,
spinoff
usesStreams::Stdout
.