Struct atomic_counter::RelaxedCounter
[−]
[src]
pub struct RelaxedCounter(_);
Implementation of AtomicCounter
that uses
Relaxed
memory ordering.
See crate level documentation for more details.
Note that all operations wrap if the counter is incremented beyond usize::max_value().
Methods
impl RelaxedCounter
[src]
fn new(initial_count: usize) -> RelaxedCounter
[src]
Creates a new counter with initial_value
Trait Implementations
impl Debug for RelaxedCounter
[src]
impl Default for RelaxedCounter
[src]
fn default() -> RelaxedCounter
[src]
Returns the "default value" for a type. Read more
impl AtomicCounter for RelaxedCounter
[src]
type PrimitiveType = usize
Underlying primitive type that is being shared atomically.
fn inc(&self)
[src]
Atomically increments the counter by one.
fn add(&self, amount: usize)
[src]
Atomically increments the counter by amount.
fn get(&self) -> usize
[src]
Atomically gets the current value of the counter, without modifying the counter.
fn reset(&self) -> usize
[src]
Atomically returns the current value of the counter, while resetting to count to zero.
fn into_inner(self) -> usize
[src]
Consume the atomic counter and return the primitive type. Read more