atomic-primitive
Traits for primitive atomic types in Rust.
These traits provide a simple hierarchy for generic programming with Rust's primitive atomic types:
- [
PrimitiveAtomic]:AtomicBooland all atomic integer types;- [
PrimitiveAtomicInteger]: all atomic integer types;- [
PrimitiveAtomicSigned]:AtomicI8,AtomicI16,AtomicI32,AtomicI64,AtomicIsize; - [
PrimitiveAtomicUnsigned]:AtomicU8,AtomicU16,AtomicU32,AtomicU64,AtomicUsize.
- [
- [
Additionally, [AtomicPrimitive] maps non-atomic primitive types to their
atomic counterparts, mirroring the unstable
core::sync::atomic::AtomicPrimitive trait.
It is not a goal of this crate to add any functionality to the atomic types,
only to expose what is already available in the standard library in a more
generic way, and make a few experimental traits and types available on stable.
The only addition is an [AtomicPrimitive] bound on [PrimitiveAtomic::Value],
which enables bidirectional navigation between atomic and non-atomic types.
The traits are also sealed against downstream implementations to allow
expansion in a non-breaking way.
Compatibility
This crate is currently tested for Rust 1.85 and greater.