gix_features::progress

Trait Count

Source
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>;

    // Provided method
    fn inc(&self) { ... }
}
Available on crate feature progress only.
Expand description

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

Required Methods§

Source

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.

Source

fn step(&self) -> usize

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

Source

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.

Source

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

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§

Source

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§

Source§

impl Count for Box<dyn Progress>

Source§

fn set(&self, step: usize)

Source§

fn step(&self) -> usize

Source§

fn inc_by(&self, step: usize)

Source§

fn inc(&self)

Source§

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

Source§

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

Source§

fn set(&self, step: usize)

Source§

fn step(&self) -> usize

Source§

fn inc_by(&self, step: usize)

Source§

fn inc(&self)

Source§

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

Source§

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

Source§

fn set(&self, step: usize)

Source§

fn step(&self) -> usize

Source§

fn inc_by(&self, step: usize)

Source§

fn inc(&self)

Source§

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

Implementors§