Struct prodash::progress::DoOrDiscard[][src]

pub struct DoOrDiscard<T>(_);

An implementation of Progress which can be created easily from Option<impl Progress>.

Implementations

impl<T: Progress> DoOrDiscard<T>[src]

pub fn into_inner(self) -> Option<T>[src]

Obtain either the original Progress implementation or None.

pub fn take(&mut self) -> Option<T>[src]

Take out the implementation of Progress and replace it with Discard.

Trait Implementations

impl<T> From<Option<T>> for DoOrDiscard<T> where
    T: Progress
[src]

fn from(p: Option<T>) -> Self[src]

Performs the conversion.

impl<T> Progress for DoOrDiscard<T> where
    T: Progress
[src]

type SubProgress = DoOrDiscard<T::SubProgress>

The type of progress returned by add_child().

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. Read more

fn init(&mut self, max: Option<usize>, unit: Option<Unit>)[src]

Initialize the Item for receiving progress information. Read more

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. Read more

fn unit(&self) -> Option<Unit>[src]

Returns the (cloned) unit associated with this Progress

fn max(&self) -> Option<usize>[src]

Returns the maximum about of items we expect, as provided with the init(…) call

fn step(&self) -> usize[src]

Returns the current step, as controlled by inc*(…) calls

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. Read more

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. Read more

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’. Read more

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. Read more

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. Read more

fn info(&mut self, message: impl Into<String>)[src]

Create a message providing additional information about the progress thus far.

fn done(&mut self, message: impl Into<String>)[src]

Create a message indicating the task is done successfully

fn fail(&mut self, message: impl Into<String>)[src]

Create a message indicating the task failed

fn show_throughput(&mut self, start: Instant)[src]

A shorthand to print throughput information

fn show_throughput_with(&mut self, start: Instant, step: Step, unit: Unit)[src]

A shorthand to print throughput information, with the given step and unit

Auto Trait Implementations

impl<T> RefUnwindSafe for DoOrDiscard<T> where
    T: RefUnwindSafe

impl<T> Send for DoOrDiscard<T> where
    T: Send

impl<T> Sync for DoOrDiscard<T> where
    T: Sync

impl<T> Unpin for DoOrDiscard<T> where
    T: Unpin

impl<T> UnwindSafe for DoOrDiscard<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.