pub struct Bar<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Bar<'a>
impl<'a> Bar<'a>
Sourcepub fn new(len: u64, config: Config<'a>) -> Self
pub fn new(len: u64, config: Config<'a>) -> Self
Examples found in repository?
examples/example.rs (line 31)
3fn main() {
4 // Default
5 for _ in progression::bar(0..1_000) {
6 thread::sleep(Duration::from_millis(1));
7 }
8
9 // Cargo style
10 for _ in progression::bar_with_config(0..1_000, progression::Config::cargo()) {
11 thread::sleep(Duration::from_millis(1));
12 }
13
14 // Unicode style
15 for _ in progression::bar_with_config(0..1_000, progression::Config::unicode()) {
16 thread::sleep(Duration::from_millis(1));
17 }
18
19 // Uses `slice.chunks` internally for lower overhead on large numbers of items
20 for _ in progression::bar_chunks(10, &[0; 1_000]) {
21 thread::sleep(Duration::from_millis(1));
22 }
23
24 // Custom
25 for _ in progression::bar_with_config(0..1_000, progression::Config { style: progression::Style::Mono('·'), ..Default::default() }) {
26 thread::sleep(Duration::from_millis(1));
27 }
28
29 // Manual
30 let items = vec![1, 2, 3, 4, 5];
31 let bar = progression::Bar::new(items.len() as u64, progression::Config { prefix: "(items) ", ..progression::Config::cargo() });
32
33 for _ in items {
34 thread::sleep(Duration::from_millis(100));
35 bar.inc(1);
36 }
37
38 bar.finish();
39}
Sourcepub fn inc(&self, delta: u64)
pub fn inc(&self, delta: u64)
Examples found in repository?
examples/example.rs (line 35)
3fn main() {
4 // Default
5 for _ in progression::bar(0..1_000) {
6 thread::sleep(Duration::from_millis(1));
7 }
8
9 // Cargo style
10 for _ in progression::bar_with_config(0..1_000, progression::Config::cargo()) {
11 thread::sleep(Duration::from_millis(1));
12 }
13
14 // Unicode style
15 for _ in progression::bar_with_config(0..1_000, progression::Config::unicode()) {
16 thread::sleep(Duration::from_millis(1));
17 }
18
19 // Uses `slice.chunks` internally for lower overhead on large numbers of items
20 for _ in progression::bar_chunks(10, &[0; 1_000]) {
21 thread::sleep(Duration::from_millis(1));
22 }
23
24 // Custom
25 for _ in progression::bar_with_config(0..1_000, progression::Config { style: progression::Style::Mono('·'), ..Default::default() }) {
26 thread::sleep(Duration::from_millis(1));
27 }
28
29 // Manual
30 let items = vec![1, 2, 3, 4, 5];
31 let bar = progression::Bar::new(items.len() as u64, progression::Config { prefix: "(items) ", ..progression::Config::cargo() });
32
33 for _ in items {
34 thread::sleep(Duration::from_millis(100));
35 bar.inc(1);
36 }
37
38 bar.finish();
39}
Sourcepub fn finish(self)
pub fn finish(self)
Examples found in repository?
examples/example.rs (line 38)
3fn main() {
4 // Default
5 for _ in progression::bar(0..1_000) {
6 thread::sleep(Duration::from_millis(1));
7 }
8
9 // Cargo style
10 for _ in progression::bar_with_config(0..1_000, progression::Config::cargo()) {
11 thread::sleep(Duration::from_millis(1));
12 }
13
14 // Unicode style
15 for _ in progression::bar_with_config(0..1_000, progression::Config::unicode()) {
16 thread::sleep(Duration::from_millis(1));
17 }
18
19 // Uses `slice.chunks` internally for lower overhead on large numbers of items
20 for _ in progression::bar_chunks(10, &[0; 1_000]) {
21 thread::sleep(Duration::from_millis(1));
22 }
23
24 // Custom
25 for _ in progression::bar_with_config(0..1_000, progression::Config { style: progression::Style::Mono('·'), ..Default::default() }) {
26 thread::sleep(Duration::from_millis(1));
27 }
28
29 // Manual
30 let items = vec![1, 2, 3, 4, 5];
31 let bar = progression::Bar::new(items.len() as u64, progression::Config { prefix: "(items) ", ..progression::Config::cargo() });
32
33 for _ in items {
34 thread::sleep(Duration::from_millis(100));
35 bar.inc(1);
36 }
37
38 bar.finish();
39}
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for Bar<'a>
impl<'a> RefUnwindSafe for Bar<'a>
impl<'a> Send for Bar<'a>
impl<'a> Sync for Bar<'a>
impl<'a> Unpin for Bar<'a>
impl<'a> UnwindSafe for Bar<'a>
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