Trait gix::Count

pub trait Count {
    // Required methods
    fn set(&self, step: usize);
    fn step(&self) -> usize;
    fn inc_by(&self, step: usize);
    fn counter(&self) -> Arc<AtomicUsize, Global>;

    // Provided method
    fn inc(&self) { ... }
}
Expand description

A thread-safe read-only counter, with unknown limits.

Required Methods§

fn set(&self, step: usize)

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.

fn step(&self) -> usize

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

fn inc_by(&self, step: usize)

Increment the current progress to the given step. The cost of this call is negligible, making manual throttling not necessary.

fn counter(&self) -> Arc<AtomicUsize, Global>

Return an atomic counter for direct access to the underlying state.

This is useful if multiple threads want to access the same progress, without the need for provide each their own progress and aggregating the result.

Provided Methods§

fn inc(&self)

Increment the current progress to the given 1. The cost of this call is negligible, making manual throttling not necessary.

Implementations on Foreign Types§

§

impl<'a, T> Count for &'a Twhere T: Count + ?Sized,

§

fn set(&self, step: usize)

§

fn step(&self) -> usize

§

fn inc_by(&self, step: usize)

§

fn inc(&self)

§

fn counter(&self) -> Arc<AtomicUsize, Global>

§

impl Count for Box<dyn Progress, Global>

§

fn set(&self, step: usize)

§

fn step(&self) -> usize

§

fn inc_by(&self, step: usize)

§

fn inc(&self)

§

fn counter(&self) -> Arc<AtomicUsize, Global>

§

impl<'a, T> Count for &'a mut Twhere T: Count + ?Sized,

§

fn set(&self, step: usize)

§

fn step(&self) -> usize

§

fn inc_by(&self, step: usize)

§

fn inc(&self)

§

fn counter(&self) -> Arc<AtomicUsize, Global>

Implementors§

§

impl Count for BoxedDynNestedProgress

§

impl Count for Discard

§

impl<L, R> Count for Either<L, R>where L: Count, R: Count,

§

impl<T> Count for DoOrDiscard<T>where T: Count,

§

impl<T> Count for DynNestedProgressToNestedProgress<T>where T: Count + ?Sized,

§

impl<T> Count for ThroughputOnDrop<T>where T: NestedProgress,