[−][src]Trait git_features::progress::Progress
A trait for describing hierarchical process.
Associated Types
type SubProgress: Progress[src]
The type of progress returned by add_child().
Required methods
pub fn add_child(&mut self, name: impl Into<String>) -> Self::SubProgress[src]
Adds a new child, whose parent is this instance, with the given name.
This will make the child progress to appear contained in the parent progress.
pub fn init(&mut self, max: Option<usize>, unit: Option<Unit>)[src]
Initialize the Item for receiving progress information.
If max is Some(…), it will be treated as upper bound. When progress is set(…)
it should not exceed the given maximum.
If max is None, the progress is unbounded. Use this if the amount of work cannot accurately
be determined in advance.
If unit is Some(…), it is used for display purposes only. See prodash::Unit for more information.
If this method is never called, this Progress instance will serve as organizational unit, useful to add more structure
to the progress tree (e.g. a headline).
Note that this method can be called multiple times, changing the bounded-ness and unit at will.
pub fn set(&mut self, step: usize)[src]
Set the current progress to the given step. The cost of this call is negligible,
making manual throttling not necessary.
Note: that this call has no effect unless init(…) was called before.
pub fn step(&self) -> usize[src]
Returns the current step, as controlled by inc*(…) calls
pub fn inc_by(&mut self, step: usize)[src]
Increment the current progress to the given step.
The cost of this call is negligible, making manual throttling not necessary.
pub fn set_name(&mut self, name: impl Into<String>)[src]
Set the name of the instance, altering the value given when crating it with add_child(…)
The progress is allowed to discard it.
pub fn name(&self) -> Option<String>[src]
Get the name of the instance as given when creating it with add_child(…)
The progress is allowed to not be named, thus there is no guarantee that a previously set names 'sticks'.
pub fn message(&mut self, level: MessageLevel, message: impl Into<String>)[src]
Create a message of the given level and store it with the progress tree.
Use this to provide additional,human-readable information about the progress made, including indicating success or failure.
Provided methods
pub fn unit(&self) -> Option<Unit>[src]
Returns the (cloned) unit associated with this Progress
pub fn max(&self) -> Option<usize>[src]
Returns the maximum about of items we expect, as provided with the init(…) call
pub fn inc(&mut self)[src]
Increment the current progress to the given 1. The cost of this call is negligible, making manual throttling not necessary.
pub fn info(&mut self, message: impl Into<String>)[src]
Create a message providing additional information about the progress thus far.
pub fn done(&mut self, message: impl Into<String>)[src]
Create a message indicating the task is done successfully
pub fn fail(&mut self, message: impl Into<String>)[src]
Create a message indicating the task failed
pub fn show_throughput(&mut self, start: Instant)[src]
A shorthand to print throughput information
pub fn show_throughput_with(&mut self, start: Instant, step: usize, unit: Unit)[src]
A shorthand to print throughput information, with the given step and unit
Implementors
impl Progress for Discard[src]
type SubProgress = Discard
pub fn add_child(
&mut self,
_name: impl Into<String>
) -> <Discard as Progress>::SubProgress[src]
&mut self,
_name: impl Into<String>
) -> <Discard as Progress>::SubProgress
pub fn init(&mut self, _max: Option<usize>, _unit: Option<Unit>)[src]
pub fn set(&mut self, _step: usize)[src]
pub fn step(&self) -> usize[src]
pub fn inc_by(&mut self, _step: usize)[src]
pub fn set_name(&mut self, _name: impl Into<String>)[src]
pub fn name(&self) -> Option<String>[src]
pub fn message(&mut self, _level: MessageLevel, _message: impl Into<String>)[src]
impl<L, R> Progress for Either<L, R> where
R: Progress,
L: Progress, [src]
R: Progress,
L: Progress,
type SubProgress = Either<<L as Progress>::SubProgress, <R as Progress>::SubProgress>
pub fn add_child(
&mut self,
name: impl Into<String>
) -> <Either<L, R> as Progress>::SubProgress[src]
&mut self,
name: impl Into<String>
) -> <Either<L, R> as Progress>::SubProgress
pub fn init(&mut self, max: Option<usize>, unit: Option<Unit>)[src]
pub fn set(&mut self, step: usize)[src]
pub fn unit(&self) -> Option<Unit>[src]
pub fn max(&self) -> Option<usize>[src]
pub fn step(&self) -> usize[src]
pub fn inc_by(&mut self, step: usize)[src]
pub fn set_name(&mut self, name: impl Into<String>)[src]
pub fn name(&self) -> Option<String>[src]
pub fn message(&mut self, level: MessageLevel, message: impl Into<String>)[src]
impl<T> Progress for DoOrDiscard<T> where
T: Progress, [src]
T: Progress,
type SubProgress = DoOrDiscard<<T as Progress>::SubProgress>
pub fn add_child(
&mut self,
name: impl Into<String>
) -> <DoOrDiscard<T> as Progress>::SubProgress[src]
&mut self,
name: impl Into<String>
) -> <DoOrDiscard<T> as Progress>::SubProgress
pub fn init(&mut self, max: Option<usize>, unit: Option<Unit>)[src]
pub fn set(&mut self, step: usize)[src]
pub fn unit(&self) -> Option<Unit>[src]
pub fn max(&self) -> Option<usize>[src]
pub fn step(&self) -> usize[src]
pub fn inc_by(&mut self, step: usize)[src]
pub fn set_name(&mut self, name: impl Into<String>)[src]
pub fn name(&self) -> Option<String>[src]
pub fn message(&mut self, level: MessageLevel, message: impl Into<String>)[src]
impl<T> Progress for ThroughputOnDrop<T> where
T: Progress, [src]
T: Progress,
type SubProgress = <T as Progress>::SubProgress
pub fn add_child(
&mut self,
name: impl Into<String>
) -> <ThroughputOnDrop<T> as Progress>::SubProgress[src]
&mut self,
name: impl Into<String>
) -> <ThroughputOnDrop<T> as Progress>::SubProgress