pub struct Loading { /* private fields */ }Implementations§
Source§impl Loading
impl Loading
Sourcepub fn with_stdout(spinner: Spinner) -> Self
pub fn with_stdout(spinner: Spinner) -> Self
Create a stdout loading
Examples found in repository?
examples/spinner.rs (line 6)
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}Sourcepub fn with_stderr(spinner: Spinner) -> Self
pub fn with_stderr(spinner: Spinner) -> Self
Create a stderr loading
Examples found in repository?
examples/spinner.rs (line 14)
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}Sourcepub fn end(self)
pub fn end(self)
End loading
Examples found in repository?
examples/loading.rs (line 15)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..=100 {
9 loading.text(format!("Loading {}", i));
10 thread::sleep(Duration::from_millis(50));
11 }
12
13 loading.success("OK");
14
15 loading.end();
16}More examples
examples/download.rs (line 22)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..100 {
9 loading.text(format!("Download 'loading.rar' {}%", i));
10 thread::sleep(Duration::from_millis(30));
11 }
12
13 loading.fail("Download 'loading.rar' failed");
14
15 for i in 0..100 {
16 loading.text(format!("Download 'loading.zip' {}%", i));
17 thread::sleep(Duration::from_millis(30));
18 }
19
20 loading.success("Download 'loading.zip' successfully");
21
22 loading.end();
23}examples/status.rs (line 22)
5fn main() {
6 let loading = Loading::default();
7
8 for status in 0..4 {
9 for i in 0..5 {
10 loading.text(format!("Loading {}", i));
11 thread::sleep(Duration::from_millis(200));
12 }
13 match status {
14 0 => loading.fail("Fail ..."),
15 1 => loading.warn("Warn ..."),
16 2 => loading.info("Info ..."),
17 3 => loading.success("Successs ..."),
18 _ => {}
19 };
20 }
21
22 loading.end();
23}examples/spinner.rs (line 12)
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}Sourcepub fn text<T: ToString>(&self, text: T)
pub fn text<T: ToString>(&self, text: T)
Modify the currently displayed text
Examples found in repository?
examples/loading.rs (line 9)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..=100 {
9 loading.text(format!("Loading {}", i));
10 thread::sleep(Duration::from_millis(50));
11 }
12
13 loading.success("OK");
14
15 loading.end();
16}More examples
examples/download.rs (line 9)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..100 {
9 loading.text(format!("Download 'loading.rar' {}%", i));
10 thread::sleep(Duration::from_millis(30));
11 }
12
13 loading.fail("Download 'loading.rar' failed");
14
15 for i in 0..100 {
16 loading.text(format!("Download 'loading.zip' {}%", i));
17 thread::sleep(Duration::from_millis(30));
18 }
19
20 loading.success("Download 'loading.zip' successfully");
21
22 loading.end();
23}examples/status.rs (line 10)
5fn main() {
6 let loading = Loading::default();
7
8 for status in 0..4 {
9 for i in 0..5 {
10 loading.text(format!("Loading {}", i));
11 thread::sleep(Duration::from_millis(200));
12 }
13 match status {
14 0 => loading.fail("Fail ..."),
15 1 => loading.warn("Warn ..."),
16 2 => loading.info("Info ..."),
17 3 => loading.success("Successs ..."),
18 _ => {}
19 };
20 }
21
22 loading.end();
23}examples/spinner.rs (line 8)
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}Sourcepub fn success<T: ToString>(&self, text: T)
pub fn success<T: ToString>(&self, text: T)
Save the current line as ‘success’ and continue to load on the next line
Examples found in repository?
examples/loading.rs (line 13)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..=100 {
9 loading.text(format!("Loading {}", i));
10 thread::sleep(Duration::from_millis(50));
11 }
12
13 loading.success("OK");
14
15 loading.end();
16}More examples
examples/download.rs (line 20)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..100 {
9 loading.text(format!("Download 'loading.rar' {}%", i));
10 thread::sleep(Duration::from_millis(30));
11 }
12
13 loading.fail("Download 'loading.rar' failed");
14
15 for i in 0..100 {
16 loading.text(format!("Download 'loading.zip' {}%", i));
17 thread::sleep(Duration::from_millis(30));
18 }
19
20 loading.success("Download 'loading.zip' successfully");
21
22 loading.end();
23}examples/status.rs (line 17)
5fn main() {
6 let loading = Loading::default();
7
8 for status in 0..4 {
9 for i in 0..5 {
10 loading.text(format!("Loading {}", i));
11 thread::sleep(Duration::from_millis(200));
12 }
13 match status {
14 0 => loading.fail("Fail ..."),
15 1 => loading.warn("Warn ..."),
16 2 => loading.info("Info ..."),
17 3 => loading.success("Successs ..."),
18 _ => {}
19 };
20 }
21
22 loading.end();
23}examples/spinner.rs (line 11)
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}Sourcepub fn fail<T: ToString>(&self, text: T)
pub fn fail<T: ToString>(&self, text: T)
Save the current line as ‘fail’ and continue to load on the next line
Examples found in repository?
examples/download.rs (line 13)
5fn main() {
6 let loading = Loading::default();
7
8 for i in 0..100 {
9 loading.text(format!("Download 'loading.rar' {}%", i));
10 thread::sleep(Duration::from_millis(30));
11 }
12
13 loading.fail("Download 'loading.rar' failed");
14
15 for i in 0..100 {
16 loading.text(format!("Download 'loading.zip' {}%", i));
17 thread::sleep(Duration::from_millis(30));
18 }
19
20 loading.success("Download 'loading.zip' successfully");
21
22 loading.end();
23}More examples
examples/status.rs (line 14)
5fn main() {
6 let loading = Loading::default();
7
8 for status in 0..4 {
9 for i in 0..5 {
10 loading.text(format!("Loading {}", i));
11 thread::sleep(Duration::from_millis(200));
12 }
13 match status {
14 0 => loading.fail("Fail ..."),
15 1 => loading.warn("Warn ..."),
16 2 => loading.info("Info ..."),
17 3 => loading.success("Successs ..."),
18 _ => {}
19 };
20 }
21
22 loading.end();
23}examples/spinner.rs (line 19)
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}Sourcepub fn warn<T: ToString>(&self, text: T)
pub fn warn<T: ToString>(&self, text: T)
Save the current line as ‘warn’ and continue to load on the next line
Examples found in repository?
examples/status.rs (line 15)
5fn main() {
6 let loading = Loading::default();
7
8 for status in 0..4 {
9 for i in 0..5 {
10 loading.text(format!("Loading {}", i));
11 thread::sleep(Duration::from_millis(200));
12 }
13 match status {
14 0 => loading.fail("Fail ..."),
15 1 => loading.warn("Warn ..."),
16 2 => loading.info("Info ..."),
17 3 => loading.success("Successs ..."),
18 _ => {}
19 };
20 }
21
22 loading.end();
23}Sourcepub fn info<T: ToString>(&self, text: T)
pub fn info<T: ToString>(&self, text: T)
Save the current line as ‘info’ and continue to load on the next line
Examples found in repository?
examples/status.rs (line 16)
5fn main() {
6 let loading = Loading::default();
7
8 for status in 0..4 {
9 for i in 0..5 {
10 loading.text(format!("Loading {}", i));
11 thread::sleep(Duration::from_millis(200));
12 }
13 match status {
14 0 => loading.fail("Fail ..."),
15 1 => loading.warn("Warn ..."),
16 2 => loading.info("Info ..."),
17 3 => loading.success("Successs ..."),
18 _ => {}
19 };
20 }
21
22 loading.end();
23}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loading
impl RefUnwindSafe for Loading
impl Send for Loading
impl Sync for Loading
impl Unpin for Loading
impl UnwindSafe for Loading
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