Trait Atomic

Source
pub trait Atomic:
    Send
    + Sync
    + Debug {
    type Inner: Copy;

    // Required methods
    fn new(initial_value: Self::Inner) -> Self;
    fn next(&self, step: Self::Inner) -> Self::Inner;
    fn current(&self) -> Self::Inner;
}
Expand description

Only for type-safe purposes. You don’t need to use this trait.

Required Associated Types§

Required Methods§

Source

fn new(initial_value: Self::Inner) -> Self

Source

fn next(&self, step: Self::Inner) -> Self::Inner

Source

fn current(&self) -> Self::Inner

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 Atomic for AtomicU8

Source§

type Inner = u8

Source§

fn new(initial_value: Self::Inner) -> Self

Source§

fn next(&self, step: Self::Inner) -> Self::Inner

Source§

fn current(&self) -> Self::Inner

Source§

impl Atomic for AtomicU16

Source§

type Inner = u16

Source§

fn new(initial_value: Self::Inner) -> Self

Source§

fn next(&self, step: Self::Inner) -> Self::Inner

Source§

fn current(&self) -> Self::Inner

Source§

impl Atomic for AtomicU32

Source§

type Inner = u32

Source§

fn new(initial_value: Self::Inner) -> Self

Source§

fn next(&self, step: Self::Inner) -> Self::Inner

Source§

fn current(&self) -> Self::Inner

Source§

impl Atomic for AtomicU64

Source§

type Inner = u64

Source§

fn new(initial_value: Self::Inner) -> Self

Source§

fn next(&self, step: Self::Inner) -> Self::Inner

Source§

fn current(&self) -> Self::Inner

Source§

impl Atomic for AtomicUsize

Source§

type Inner = usize

Source§

fn new(initial_value: Self::Inner) -> Self

Source§

fn next(&self, step: Self::Inner) -> Self::Inner

Source§

fn current(&self) -> Self::Inner

Implementors§