simple library for displaying spinners in the terminal
Add as a dependency to your Cargo.toml
:
toml
[dependencies]
spinoff = "0.4.0"
```rust use spinoff::{Spinner, Spinners, Color}; use std::thread::sleep; use std::time::Duration;
let spinner = Spinner::new(Spinners::Dots, "Loading...", Color::Blue); sleep(Duration::from_secs(3)); spinner.success("Done!"); ```
```rust use spinoff::{Spinner, Spinners, Color}; use std::thread::sleep; use std::time::Duration;
let mut spinner = Spinner::new(Spinners::Dots, "Loading...", Color::Red); sleep(Duration::fromsecs(3)); spinner.update(Spinners::Dots2, "Loading...", None); sleep(Duration::fromsecs(3)); spinner.stop() ```
```rust use spinoff::{Spinner, Spinners, Color}; use std::thread::sleep; use std::time::Duration;
let mut spinner = Spinner::new(Spinners::Dots, "Loading...", Color::Green); sleep(Duration::fromsecs(3)); spinner.stopand_persist("📜", "Task done."); ```
Other examples can be found in the documentation.
Spinner
options, check the Spinners
enum.To run some of the included examples, use:
bash
cargo run --example all_spinners
bash
cargo run --example simple
Any contributions to this crate are highly appreciated. If you have any ideas/suggestions/bug fixes, please open an issue or a pull request. If you like the project, star this project on GitHub.
This crate is licensed under the MIT license.