spinner/
spinner.rs

1use loading::{Loading, Spinner};
2use std::thread;
3use std::time::Duration;
4
5fn main() {
6    let loading = Loading::with_stdout(Spinner::new(vec!["◐", "◓", "◑", "◒"]));
7    for i in 0..10 {
8        loading.text(format!("Loading {}", i));
9        thread::sleep(Duration::from_millis(200));
10    }
11    loading.success("Successs ...");
12    loading.end();
13
14    let loading = Loading::with_stderr(Spinner::new(vec!["∙∙∙", "●∙∙", "∙●∙", "∙∙●"]));
15    for i in 0..10 {
16        loading.text(format!("Loading {}", i));
17        thread::sleep(Duration::from_millis(200));
18    }
19    loading.fail("Error ...");
20    loading.end();
21}