pub trait FromPtr: Atomic {
// Required method
unsafe fn from_ptr<'a>(ptr: *mut Self::Type) -> &'a Self;
}Expand description
Creates a new atomic type from a pointer.
Required Methods§
Sourceunsafe fn from_ptr<'a>(ptr: *mut Self::Type) -> &'a Self
unsafe fn from_ptr<'a>(ptr: *mut Self::Type) -> &'a Self
Creates a new atomic type from a pointer.
§Safety
ptrmust be aligned toalign_of::<Self>()(note that on some platforms this can be bigger thanalign_of::<Self::Type>()).ptrmust be [valid] for both reads and writes for the whole lifetime'a.- You must adhere to the [Memory model for atomic accesses]. In particular, it is not allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes, without synchronization.
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.
Implementations on Foreign Types§
Source§impl FromPtr for AtomicI8
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicI8
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicI16
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicI16
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicI32
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicI32
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicI64
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicI64
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicIsize
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicIsize
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicU8
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicU8
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicU16
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicU16
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicU32
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicU32
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicU64
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicU64
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl FromPtr for AtomicUsize
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl FromPtr for AtomicUsize
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.Source§impl<T> FromPtr for AtomicPtr<T>
Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
impl<T> FromPtr for AtomicPtr<T>
Available on (crate features
atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.