1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//! avance is a rust library that helps you easily report progress in
//! command line applications. It supports tracing progress in concurrent programs, and
//! also offers various utilities for customizing a progress bar.
//!
//! avance means advance or progress in spanish. This naming was inspired by
//! [tqdm](https://github.com/tqdm/tqdm), which was named after an arabic word.
//!
//! Here is an example of using avance in multiple threads:
//!
//! <img src="https://github.com/Aubrey-Liu/avance/raw/main/screenshots/multi.gif">
//!
//! # Platform support
//!
//! * Linux
//! * macOS
//! * Windows
//!
//! # Progress Bar
//!
//! [`AvanceBar`] satisfies common usage of tracing progress. It can display necessary
//! progress statistics, and can be used in the bounded or unbounded way.
//!
//! ```
//! use avance::AvanceBar;
//!
//! let pb = AvanceBar::new(100);
//! for _ in 0..100 {
//! // ...
//! pb.inc();
//! }
//! // Don't need to close a bar manually. It will close automatically when being dropped.
//! ```
//!
//! You're able to adjust the width, style and many other configs of a progress bar.
//! ```
//! use avance::{AvanceBar, Style};
//!
//! let pb = AvanceBar::new(100)
//! .with_style(Style::Balloon)
//! .with_width(80)
//! .with_desc("avance");
//!
//! // Use a progress bar along with an iterator, eliminating the need for invoking inc or update.
//! for _ in pb.with_iter(0..100) {
//! // ...
//! }
//! ```
//!
//! ## Behaviors:
//! - A progress bar will refresh when:
//! - [`new`](AvanceBar::new) or [`close`](AvanceBar::close)
//! - [`inc`](AvanceBar::inc) or [`update`](AvanceBar::update)
//! - configuration changes (such as changing its style or width)
//! - If a progress bar's width is too large, environment width will be used instead.
//! - A progress bar can be **shared among threads fearlessly**.
//!
//! # Iterator
//!
//! Progress bar can also be associated with an iterator.
//!
//! ```
//! use avance::{AvanceIterator, Style};
//!
//! for _ in (0..100).avance().with_style(Style::ASCII).with_width(80) {
//! // ...
//! }
//!
//! // avance provides the flexibility of changing a progress bar when iterating
//! for (_, pb) in (0..100).avance().with_pb() {
//! // ...
//! pb.set_postfix("");
//! }
//! ```
//!
//! # Style
//!
//! avance provides a range of pre-definded progress styles (at [`Style`]),
//! and also allows users to easily **customize** the style according to their preferences.
//!
//! ```
//! # use avance::AvanceIterator;
//! for _ in (0..1000).avance().with_style_str("=>-") {
//! // ...
//! }
//! ```
//!
//! # TODOs:
//! - [ ] A progress bar for io pipes
//! - [ ] A Monitor for very slow progress bars
pub
pub use ;
pub use ;
pub use Style;