Struct iter_progress::ProgressRecord
[−]
[src]
pub struct ProgressRecord { // some fields omitted }
Methods
impl ProgressRecord
[src]
fn message(&self) -> String
Returns a basic log message of where we are now. You can construct this yourself, but this is a helpful convience method.
fn duration_since_start(&self) -> Duration
Duration since iteration started
fn num_done(&self) -> usize
Number of items we've generated so far
fn previous_record_tm(&self) -> Option<Tm>
Tm for when the previous record was generated. None if there was no previous record.
fn started_iterating(&self) -> Tm
When the iteration started
fn print_message(&self)
Prints a basic message
fn rate(&self) -> f32
Number of items per second
fn fraction(&self) -> Option<f32>
None if we don't know how much we've done (as a fraction), otherwise a value form 0 to 1 for what fraction along we are.
fn percent(&self) -> Option<f32>
None if we don't know how much we've done, otherwise value for 0 to 100 representing how far along as a percentage we are.
fn print_every_n_sec<T: Display>(&self, n: f32, msg: T)
Print out msg
, but only if there has been n
seconds since last printout
fn do_every_n_sec<F: Fn(&Self)>(&self, n: f32, f: F)
Do thing but only every n sec (as far as possible). Could be a print statement.
fn should_do_every_n_sec(&self, n: f32) -> bool
If we want to print every n
sec, should we print now?
fn should_do_every_n_items(&self, n: usize) -> bool
If we want to print every n
items, should we print now?
fn print_every_n_items<T: Display>(&self, n: usize, msg: T)
Print out msg
, but only if there has been n
items.
Often you want to print out a debug message every 1,000 items or so. This function does
that.
fn do_every_n_items<F: Fn(&Self)>(&self, n: usize, f: F)
Do thing but only every n items. Could be a print statement.
fn recent_rate(&self) -> f32
The rate of the last few items.