pub struct Config {
pub prefix: Cow<'static, str>,
pub total: Option<f64>,
pub leave: bool,
pub disable: bool,
pub unit: Cow<'static, str>,
pub unit_scale: f64,
pub postfix: Cow<'static, str>,
pub colour: Cow<'static, str>,
pub progress_chars: Cow<'static, str>,
}
Expand description
Configuration for the Tqdm
and ParTqdm
progress bars.
Fields§
§prefix: Cow<'static, str>
Placed at the start of the progress bar (default = “”)
total: Option<f64>
Expected number of iterations (default = iter.len()
)
leave: bool
Whether or not to leave the progress bar behind after completion (default = true)
disable: bool
Hides the progress bar (default = false)
unit: Cow<'static, str>
Measurement type used for it/s (default = “it”)
unit_scale: f64
Scales the it/s, position, and total numbers. (default = 1)
postfix: Cow<'static, str>
Placed at the end of the progress bar (default = “”)
colour: Cow<'static, str>
Color used for the progress bar (default = “white”)
progress_chars: Cow<'static, str>
Characters used for displaying the progress bar.
Implementations§
Source§impl Config
impl Config
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Examples found in repository?
More examples
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_prefix(self, prefix: impl Into<Cow<'static, str>>) -> Self
pub fn with_prefix(self, prefix: impl Into<Cow<'static, str>>) -> Self
Placed at the start of the progress bar (default = “”)
Sourcepub fn with_desc(self, desc: impl Into<Cow<'static, str>>) -> Self
pub fn with_desc(self, desc: impl Into<Cow<'static, str>>) -> Self
Placed at the start of the progress bar (default = “”) Like tqdm this method adds “: “ to the end of the prefix.
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_total(self, total: u64) -> Self
pub fn with_total(self, total: u64) -> Self
Expected number of iterations (default = iter.len()
)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_total_float(self, total: f64) -> Self
pub fn with_total_float(self, total: f64) -> Self
Expected number of iterations (default = iter.len()
)
Sourcepub fn with_leave(self, leave: bool) -> Self
pub fn with_leave(self, leave: bool) -> Self
Whether or not to leave the progress bar behind after completion (default = true)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_disable(self, disable: bool) -> Self
pub fn with_disable(self, disable: bool) -> Self
Hides the progress bar (default = false)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_unit(self, unit: impl Into<Cow<'static, str>>) -> Config
pub fn with_unit(self, unit: impl Into<Cow<'static, str>>) -> Config
Measurement type used for it/s (default = “it”)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_scale(self, scale: impl Into<f64>) -> Config
pub fn with_scale(self, scale: impl Into<f64>) -> Config
Scales the it/s, position, and total numbers. (default = 1)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_postfix(self, postfix: impl Into<Cow<'static, str>>) -> Config
pub fn with_postfix(self, postfix: impl Into<Cow<'static, str>>) -> Config
Placed at the end of the progress bar (default = “”)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_color(self, colour: impl Into<Cow<'static, str>>) -> Config
pub fn with_color(self, colour: impl Into<Cow<'static, str>>) -> Config
Color used for the progress bar (default = “white”)
Examples found in repository?
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}
Sourcepub fn with_progress_chars(
self,
progress_chars: impl Into<Cow<'static, str>>,
) -> Config
pub fn with_progress_chars( self, progress_chars: impl Into<Cow<'static, str>>, ) -> Config
Characters used for displaying the progress bar.
Examples found in repository?
More examples
4fn main() {
5 let config = simple_tqdm::Config::new()
6 .with_desc("[]")
7 .with_total(500)
8 .with_disable(false)
9 .with_leave(true)
10 .with_unit("num")
11 .with_scale(0.5)
12 .with_postfix("hi")
13 .with_color("cyan")
14 .with_disable(true)
15 .with_progress_chars(">= ");
16
17 for _ in (0..250).tqdm_config(config) {
18 std::thread::sleep(Duration::from_millis(10));
19 }
20}