pub struct Spinner { /* private fields */ }Expand description
§Example:
use multi_spinner::{Spinner, spinners::Animation};
use std::{ thread::{self}, time::Duration, sync::{Arc, Mutex}, };
fn main() {
let stdout = Arc::new(Mutex::new(std::io::stdout()));
let files = ["file1", "file2", "file3", "file4", "file5"];
let handles = files.iter().enumerate().map(|(i, file)|{
let file = file.to_owned();
let stdout = stdout.clone();
thread::spawn(move ||{
let mut spinner = Spinner::builder()
.spinner(Animation::Bars10(0))
.msg(format!("downloading {file}\n"))
.row(i)
.stdout(stdout)
.build();
spinner.start();
thread::sleep(Duration::from_secs(3));
spinner.stop().expect("stopped");
})
}).collect::<Vec<_>>();
for handle in handles {
let () = handle.join().expect("join thread");
}
}Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Spinner
impl RefUnwindSafe for Spinner
impl Send for Spinner
impl Sync for Spinner
impl Unpin for Spinner
impl UnwindSafe for Spinner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more