Skip to main content

RollingCounter

Trait RollingCounter 

Source
pub trait RollingCounter {
    type NonAtomic;

    const DEFAULT: Self;

    // Required method
    fn next(&self) -> Self::NonAtomic;
}
Expand description

A trait for types that can be used as rolling counters. It is only intended for the atomic counterparts to Identifier types.

Required Associated Constants§

Source

const DEFAULT: Self

The starting value of the rolling counter.

Required Associated Types§

Source

type NonAtomic

The non-atomic identifier type associated with this atomic type.

Required Methods§

Source

fn next(&self) -> Self::NonAtomic

Atomically increments the value and returns the previous value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl RollingCounter for AtomicU8

Source§

const DEFAULT: Self

Source§

type NonAtomic = u8

Source§

fn next(&self) -> Self::NonAtomic

Source§

impl RollingCounter for AtomicU16

Source§

const DEFAULT: Self

Source§

type NonAtomic = u16

Source§

fn next(&self) -> Self::NonAtomic

Source§

impl RollingCounter for AtomicU32

Source§

const DEFAULT: Self

Source§

type NonAtomic = u32

Source§

fn next(&self) -> Self::NonAtomic

Source§

impl RollingCounter for AtomicU64

Source§

const DEFAULT: Self

Source§

type NonAtomic = u64

Source§

fn next(&self) -> Self::NonAtomic

Source§

impl RollingCounter for AtomicU128

Source§

const DEFAULT: Self

Source§

type NonAtomic = u128

Source§

fn next(&self) -> Self::NonAtomic

Implementors§