pub trait RefCount {
    type Value;

    // Required methods
    fn one() -> Self;
    fn is_one(val: &Self::Value) -> bool;
    fn load(&self) -> Self::Value;
    fn fetch_inc(&self) -> Self::Value;
    fn fetch_dec(&self) -> Self::Value;
}
Expand description

Trait for refcount

Required Associated Types§

source

type Value

Type of count

Required Methods§

source

fn one() -> Self

Creates a new RefCount object.

The object is initialized as “one”.

source

fn is_one(val: &Self::Value) -> bool

Checks a value equals to one.

source

fn load(&self) -> Self::Value

Gets a current value.

source

fn fetch_inc(&self) -> Self::Value

Increments its value and returns previous value.

source

fn fetch_dec(&self) -> Self::Value

Decrements its value and returns previous value.

Implementations on Foreign Types§

source§

impl RefCount for Cell<u32>

§

type Value = u32

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for AtomicUsize

§

type Value = usize

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for Cell<u64>

§

type Value = u64

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for AtomicU32

§

type Value = u32

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for Cell<usize>

§

type Value = usize

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for Cell<u8>

§

type Value = u8

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for AtomicU16

§

type Value = u16

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for AtomicU8

§

type Value = u8

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for Cell<u16>

§

type Value = u16

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

source§

impl RefCount for AtomicU64

§

type Value = u64

source§

fn one() -> Self

source§

fn is_one(val: &Self::Value) -> bool

source§

fn load(&self) -> Self::Value

source§

fn fetch_inc(&self) -> Self::Value

source§

fn fetch_dec(&self) -> Self::Value

Implementors§