pub unsafe trait AtomicPodBlob:
Default
+ Send
+ Sync
+ 'static { }Expand description
Describes a type that has the same bit pattern as another type, but is made
up entirely of an array of std::sync::atomic::AtomicU32 values.
This trait enables values of whatever type this mirrors to be written from multiple threads. It’s memory-safe because the type must be POD. However, this doesn’t protect against data races; it’s possible for safe code to see partially-updated values, which might be incorrect. Therefore, use this type with caution.
The crate::impl_atomic_pod macro that generates an implementation of
AtomicPod automatically generates a blob type that implements
AtomicPodBlob. This is the preferred way to implement this trait and
doesn’t require any unsafe code.
§Safety
This trait must only be implemented by types that are #[repr(transparent)]
wrappers around [AtomicU32; N] for some N (where N may legally be 0).
That’s because values implementing this trait are read as a &[u8] when
uploading to the GPU.
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.