IntoAtomic

Trait IntoAtomic 

Source
pub trait IntoAtomic:
    IsAtomic<Atomic = False>
    + Sized
    + Send
    + Sync {
    type AtomicType: Atomic<NonAtomicType = Self>;

    // Required methods
    fn to_atomic(self) -> Self::AtomicType;
    fn into_atomic_array<const N: usize>(
        data: [Self; N],
    ) -> [Self::AtomicType; N];
    fn from_atomic_array<const N: usize>(
        data: [Self::AtomicType; N],
    ) -> [Self; N];
    fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self];
    fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType];
    fn get_mut_array<const N: usize>(
        this: &mut [Self::AtomicType; N],
    ) -> &mut [Self; N];
    fn from_mut_array<const N: usize>(
        this: &mut [Self; N],
    ) -> &mut [Self::AtomicType; N];
}
Expand description

A trait for types that have an equivalent atomic type.

Required Associated Types§

Source

type AtomicType: Atomic<NonAtomicType = Self>

The atomic variant of the type.

Required Methods§

Source

fn to_atomic(self) -> Self::AtomicType

Convert self into the atomic variant of Self

Source

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Convert an array of non-atomic values into an array of atomic values.

Source

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Convert an array of atomic values into an array of non-atomic values.

Source

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Convert a slice of non-atomic values into a slice of atomic values.

Source

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Convert a slice of atomic values into a slice of non-atomic values.

Source

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Convert a reference to an array of non-atomic values into a reference to an array of atomic values.

Source

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Convert a reference to an array of atomic values into a reference to an array of non-atomic values.

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 IntoAtomic for bool

Source§

type AtomicType = AtomicBool

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for f32

Source§

type AtomicType = AtomicF32

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for f64

Source§

type AtomicType = AtomicF64

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for i8

Source§

type AtomicType = AtomicI8

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for i16

Source§

type AtomicType = AtomicI16

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for i32

Source§

type AtomicType = AtomicI32

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for i64

Source§

type AtomicType = AtomicI64

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for isize

Source§

type AtomicType = AtomicIsize

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for u8

Source§

type AtomicType = AtomicU8

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for u16

Source§

type AtomicType = AtomicU16

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for u32

Source§

type AtomicType = AtomicU32

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for u64

Source§

type AtomicType = AtomicU64

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for usize

Source§

type AtomicType = AtomicUsize

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for bf16

Source§

type AtomicType = AtomicBF16

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Source§

impl IntoAtomic for f16

Source§

type AtomicType = AtomicF16

Source§

fn to_atomic(self) -> Self::AtomicType

Source§

fn into_atomic_array<const N: usize>(data: [Self; N]) -> [Self::AtomicType; N]

Source§

fn from_atomic_array<const N: usize>(data: [Self::AtomicType; N]) -> [Self; N]

Source§

fn get_mut_slice(this: &mut [Self::AtomicType]) -> &mut [Self]

Source§

fn from_mut_slice(this: &mut [Self]) -> &mut [Self::AtomicType]

Source§

fn get_mut_array<const N: usize>( this: &mut [Self::AtomicType; N], ) -> &mut [Self; N]

Source§

fn from_mut_array<const N: usize>( this: &mut [Self; N], ) -> &mut [Self::AtomicType; N]

Implementors§