Struct atomic_counter::ConsistentCounter [−][src]
pub struct ConsistentCounter(_);
Implementation of AtomicCounter
that uses
Sequentially Consistent
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 ConsistentCounter
[src]
impl ConsistentCounter
pub fn new(initial_count: usize) -> ConsistentCounter
[src]
pub fn new(initial_count: usize) -> ConsistentCounter
Creates a new counter with initial_value
Trait Implementations
impl Debug for ConsistentCounter
[src]
impl Debug for ConsistentCounter
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for ConsistentCounter
[src]
impl Default for ConsistentCounter
fn default() -> ConsistentCounter
[src]
fn default() -> ConsistentCounter
Returns the "default value" for a type. Read more
impl AtomicCounter for ConsistentCounter
[src]
impl AtomicCounter for ConsistentCounter
type PrimitiveType = usize
Underlying primitive type that is being shared atomically.
fn inc(&self) -> usize
[src]
fn inc(&self) -> usize
Atomically increments the counter by one, returning the previous value.
fn add(&self, amount: usize) -> usize
[src]
fn add(&self, amount: usize) -> usize
Atomically increments the counter by amount, returning the previous value.
fn get(&self) -> usize
[src]
fn get(&self) -> usize
Atomically gets the current value of the counter, without modifying the counter.
fn reset(&self) -> usize
[src]
fn reset(&self) -> usize
Atomically returns the current value of the counter, while resetting to count to zero.
fn into_inner(self) -> usize
[src]
fn into_inner(self) -> usize
Consume the atomic counter and return the primitive type. Read more
Auto Trait Implementations
impl Send for ConsistentCounter
impl Send for ConsistentCounter
impl Sync for ConsistentCounter
impl Sync for ConsistentCounter