Struct raii_counter::Counter [−][src]
pub struct Counter { /* fields omitted */ }
Essentially an AtomicUsize that is clonable and whose count is based on the number of copies. The count is automatically updated on Drop.
Methods
impl Counter
[src]
impl Counter
pub fn new() -> Counter
[src]
pub fn new() -> Counter
pub fn new_with_size(size: usize) -> Counter
[src]
pub fn new_with_size(size: usize) -> Counter
pub fn downgrade(self) -> WeakCounter
[src]
pub fn downgrade(self) -> WeakCounter
Consume self (causing the count to decrease by 1) and return a weak reference to the count through a WeakCounter
pub fn count(&self) -> usize
[src]
pub fn count(&self) -> usize
This method is inherently racey. Assume the count will have changed once the value is observed.
Trait Implementations
impl Clone for Counter
[src]
impl Clone for Counter
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Drop for Counter
[src]
impl Drop for Counter