tqdm/style.rs
1//! Progress bar style enumeration
2//!
3//! - `ASCII`: Pure ASCII bar with `"0123456789#"`
4//! - `Block`: Common bar with unicode characters `" ▏▎▍▌▋▊▉█"`
5//! - `Balloon`: Simulate balloon explosion with `".oO@*"`. Inspired by [stackoverflow](https://stackoverflow.com/a/2685509/17570263)
6//! - `Pacman`: Inspired by Arch Linux ILoveCandy
7//! - `Custom`: Create a custom progressbar style
8//!
9//! Other styles are open for [contribution](https://github.com/mrlazy1708/tqdm/issues/1).
10
11pub enum Style {
12 ASCII,
13 Block,
14 Balloon,
15 Pacman,
16 Custom(String)
17}
18
19impl Default for Style {
20 fn default() -> Self {
21 Style::Block
22 }
23}
24
25impl std::fmt::Display for Style {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 write!(f, "{}", match self {
28 Style::ASCII => "0123456789#",
29 Style::Block => " ▏▎▍▌▋▊▉█",
30 Style::Balloon => ".oO@*",
31 Style::Pacman => "C-",
32 Style::Custom(n) => &n[..],
33 })
34 }
35}