This crate serves as an alternative to loading. It is used to display a throbber animation in the terminal while other calculations are done in the main program.

Usage
Add this to your Cargo.toml:
[]
= "0.1"
To display a throbber animation, first create a Throbber object:
# use Throbber;
let mut throbber = new;
You can also customize certain settings like the displayed animation and the displayed message:
# use Throbber;
let mut throbber = new
.message
.frames; // this crate comes with a few predefined animations
// see the Constants section
Then you can simply call start() wherever you want to start the animation and a finish function like success() where you want to stop it.
# use Throbber;
# let mut throbber = new;
throbber.start;
// do calculations
throbber.success;
After which you can call start() or start_with_msg(String) again to start the animation again.
You can also change everything you could customize during the Throbber object creation, e. g. with change_message(String) and change_frames(String). This also works while an animation is running.
If you don't intend to start another animation, you should drop the Throbber object with end(). This action also ends the underlying thread:
# use Throbber;
# let mut throbber = new;
throbber.end;
Examples
This is the example from the preview above:
use thread;
use Duration;
use Throbber;
You can also keep track of progress with change_message(String):
use thread;
use Duration;
use Throbber;