Skip to main content

Crate atomic_primitive

Crate atomic_primitive 

Source
Expand description

§atomic-primitive

crate documentation minimum rustc 1.85 build status

Traits for primitive atomic types in Rust.

These traits provide a simple hierarchy for generic programming with Rust’s primitive atomic types:

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.

Traits§

AtomicPrimitive
Maps a non-atomic primitive type to its corresponding atomic type.
PrimitiveAtomic
Trait for all primitive atomic types, including AtomicBool and all atomic integer types.
PrimitiveAtomicInteger
Trait for all primitive atomic integer types, extending PrimitiveAtomic.
PrimitiveAtomicSigned
Marker trait for primitive atomic signed integer types.
PrimitiveAtomicUnsigned
Marker trait for primitive atomic unsigned integer types.

Type Aliases§

Atomic
Type alias for the atomic version of a primitive type.