pub struct Spinner { /* private fields */ }
Implementations
sourceimpl Spinner
impl Spinner
sourcepub fn new(spinner: Spinners, message: String) -> Self
pub fn new(spinner: Spinners, message: String) -> Self
Create a new spinner along with a message
Examples
Basic Usage:
use spinners::{Spinner, Spinners};
let sp = Spinner::new(Spinners::Dots, "Loading things into memory...".into());
No Message:
use spinners::{Spinner, Spinners};
let sp = Spinner::new(Spinners::Dots, String::new());
sourcepub fn with_timer(spinner: Spinners, message: String) -> Self
pub fn with_timer(spinner: Spinners, message: String) -> Self
Create a new spinner that logs the time since it was created
sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Stops the spinner
Stops the spinner that was created with the Spinner::new
function.
Optionally call stop_with_newline
to print a newline after the spinner is stopped,
or the stop_with_message
function to print a message after the spinner is stopped.
Examples
Basic Usage:
use spinners::{Spinner, Spinners};
let mut sp = Spinner::new(Spinners::Dots, "Loading things into memory...".into());
sp.stop();
sourcepub fn stop_with_symbol(&mut self, symbol: &str)
pub fn stop_with_symbol(&mut self, symbol: &str)
Stop with a symbol that replaces the spinner
The symbol is a String rather than a Char to allow for more flexibility, such as using ANSI color codes.
Examples
Basic Usage:
use spinners::{Spinner, Spinners};
let mut sp = Spinner::new(Spinners::Dots, "Loading things into memory...".into());
sp.stop_with_symbol("🗸");
ANSI colors (green checkmark):
use spinners::{Spinner, Spinners};
let mut sp = Spinner::new(Spinners::Dots, "Loading things into memory...".into());
sp.stop_with_symbol("\x1b[32m🗸\x1b[0m");
sourcepub fn stop_with_newline(&mut self)
pub fn stop_with_newline(&mut self)
Stops the spinner and prints a new line
Examples
Basic Usage:
use spinners::{Spinner, Spinners};
let mut sp = Spinner::new(Spinners::Dots, "Loading things into memory...".into());
sp.stop_with_newline();
sourcepub fn stop_with_message(&mut self, msg: String)
pub fn stop_with_message(&mut self, msg: String)
Stops the spinner and prints the provided message
Examples
Basic Usage:
use spinners::{Spinner, Spinners};
let mut sp = Spinner::new(Spinners::Dots, "Loading things into memory...".into());
sp.stop_with_message("Finished loading things into memory!".into());
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Spinner
impl Send for Spinner
impl !Sync for Spinner
impl Unpin for Spinner
impl !UnwindSafe for Spinner
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more