Struct progression::Config

source ·
pub struct Config<'a> {
    pub width: Option<u64>,
    pub default_width: u64,
    pub delimiters: (char, char),
    pub style: Style,
    pub space_char: char,
    pub prefix: &'a str,
    pub num_width: usize,
    pub throttle_millis: u64,
}

Fields§

§width: Option<u64>§default_width: u64§delimiters: (char, char)§style: Style§space_char: char§prefix: &'a str§num_width: usize§throttle_millis: u64

Implementations§

Examples found in repository?
examples/example.rs (line 15)
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
fn main() {
	// Default
	for _ in progression::bar(0..1_000) {
		thread::sleep(Duration::from_millis(1));
	}

	// Cargo style
	for _ in progression::bar_with_config(0..1_000, progression::Config::cargo()) {
		thread::sleep(Duration::from_millis(1));
	}

	// Unicode style
	for _ in progression::bar_with_config(0..1_000, progression::Config::unicode()) {
		thread::sleep(Duration::from_millis(1));
	}

	// Custom
	for _ in progression::bar_with_config(0..1_000, progression::Config { style: progression::Style::Mono('·'), ..Default::default() }) {
		thread::sleep(Duration::from_millis(1));
	}

	// Manual
	let items = vec![1, 2, 3, 4, 5];
	let bar = progression::Bar::new(items.len() as u64, progression::Config { prefix: "(items) ", ..progression::Config::cargo() });

	for _ in items {
		thread::sleep(Duration::from_millis(100));
		bar.inc(1);
	}
}
Examples found in repository?
examples/example.rs (line 10)
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
fn main() {
	// Default
	for _ in progression::bar(0..1_000) {
		thread::sleep(Duration::from_millis(1));
	}

	// Cargo style
	for _ in progression::bar_with_config(0..1_000, progression::Config::cargo()) {
		thread::sleep(Duration::from_millis(1));
	}

	// Unicode style
	for _ in progression::bar_with_config(0..1_000, progression::Config::unicode()) {
		thread::sleep(Duration::from_millis(1));
	}

	// Custom
	for _ in progression::bar_with_config(0..1_000, progression::Config { style: progression::Style::Mono('·'), ..Default::default() }) {
		thread::sleep(Duration::from_millis(1));
	}

	// Manual
	let items = vec![1, 2, 3, 4, 5];
	let bar = progression::Bar::new(items.len() as u64, progression::Config { prefix: "(items) ", ..progression::Config::cargo() });

	for _ in items {
		thread::sleep(Duration::from_millis(100));
		bar.inc(1);
	}
}

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.