pub trait AtomicBits: Copy {
type Storage;
// Required methods
fn new(bits: Self) -> Self::Storage;
fn store(storage: &Self::Storage, bits: Self, ordering: Ordering);
fn load(storage: &Self::Storage, ordering: Ordering) -> Self;
fn fetch_and(
storage: &Self::Storage,
bits: Self,
ordering: Ordering,
) -> Self;
fn fetch_or(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self;
fn fetch_xor(
storage: &Self::Storage,
bits: Self,
ordering: Ordering,
) -> Self;
fn fetch_nand(
storage: &Self::Storage,
bits: Self,
ordering: Ordering,
) -> Self;
fn swap(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self;
fn compare_exchange(
storage: &Self::Storage,
current: Self,
new: Self,
success: Ordering,
failure: Ordering,
) -> Result<Self, Self>;
fn compare_exchange_weak(
storage: &Self::Storage,
current: Self,
new: Self,
success: Ordering,
failure: Ordering,
) -> Result<Self, Self>;
fn into_inner(storage: Self::Storage) -> Self;
}Expand description
Integer type that can back an AtomicFlags.
Implemented for every integer type bitflags supports except u128 and
i128, which have no atomic counterpart.
Required Associated Types§
Required Methods§
fn new(bits: Self) -> Self::Storage
fn store(storage: &Self::Storage, bits: Self, ordering: Ordering)
fn load(storage: &Self::Storage, ordering: Ordering) -> Self
fn fetch_and(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self
fn fetch_or(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self
fn fetch_xor(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self
fn fetch_nand(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self
fn swap(storage: &Self::Storage, bits: Self, ordering: Ordering) -> Self
fn compare_exchange( storage: &Self::Storage, current: Self, new: Self, success: Ordering, failure: Ordering, ) -> Result<Self, Self>
fn compare_exchange_weak( storage: &Self::Storage, current: Self, new: Self, success: Ordering, failure: Ordering, ) -> Result<Self, Self>
fn into_inner(storage: Self::Storage) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".