Trait compact_rc::refcount::RefCount
source · pub trait RefCount {
type Value;
// Required methods
fn one() -> Self;
fn is_one(val: &Self::Value) -> bool;
fn load_acquire(&self) -> Self::Value;
fn fence_acquire(&self);
fn fetch_inc_relaxed(&self) -> Self::Value;
fn fetch_dec_release(&self) -> Self::Value;
}Expand description
Trait for refcount
Some method names explain required memory ordering in multi-threaded context.
Required Associated Types§
Required Methods§
sourcefn load_acquire(&self) -> Self::Value
fn load_acquire(&self) -> Self::Value
Gets a current value.
Memory ordering
Acquire or stronger ordering is required if implementors are atomic types.
sourcefn fence_acquire(&self)
fn fence_acquire(&self)
Memory fence.
This method is needed only for multi-threaded refcount. In single-threaded implementors, this can be NO-OP.
Memory ordering
Acquire or stronger ordering is required if implementors are atomic types.
sourcefn fetch_inc_relaxed(&self) -> Self::Value
fn fetch_inc_relaxed(&self) -> Self::Value
Increments its value and returns previous value.
Memory ordering
Relaxed ordering is allowed if implementors are atomic types.
sourcefn fetch_dec_release(&self) -> Self::Value
fn fetch_dec_release(&self) -> Self::Value
Decrements its value and returns previous value.
Memory ordering
Release or stronger ordering is required if implementors are atomic types.