pub unsafe trait SameAs<T>: IntoAtomic<AtomicType = T> { }Expand description
Unsafe marker trait for types whose atomic version has the same size and bit representation.
This marker guarantees that a value can be reinterpreted between the
non-atomic type and its associated atomic type
IntoAtomic::AtomicType by copying the bytes. Note that it does not
guarantee equal alignment: on some targets an atomic type has a stricter
alignment than its non-atomic counterpart (for example, on 32-bit x86
align_of::<u64>() == 4 but align_of::<AtomicU64>() == 8), which is why the
by-reference conversions in IntoAtomic/Atomic check
alignment at run time.
It is implemented for all primitive types and for the types of the
half crate if the corresponding gate feature is enabled.
§Safety
The implementor must ensure that T has the same size and bit representation
as the associated atomic type IntoAtomic::AtomicType.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".