Skip to main content

FromPtr

Trait FromPtr 

Source
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§

Source

unsafe fn from_ptr<'a>(ptr: *mut Self::Type) -> &'a Self

Creates a new atomic type from a pointer.

§Safety
  • ptr must be aligned to align_of::<Self>() (note that on some platforms this can be bigger than align_of::<Self::Type>()).
  • ptr must 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".

Implementations on Foreign Types§

Source§

impl FromPtr for Atomic<i8>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>(ptr: *mut <Atomic<i8> as Atomic>::Type) -> &'a Atomic<i8>

Source§

impl FromPtr for Atomic<i16>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<i16> as Atomic>::Type, ) -> &'a Atomic<i16>

Source§

impl FromPtr for Atomic<i32>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<i32> as Atomic>::Type, ) -> &'a Atomic<i32>

Source§

impl FromPtr for Atomic<i64>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<i64> as Atomic>::Type, ) -> &'a Atomic<i64>

Source§

impl FromPtr for Atomic<isize>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<isize> as Atomic>::Type, ) -> &'a Atomic<isize>

Source§

impl FromPtr for Atomic<u8>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>(ptr: *mut <Atomic<u8> as Atomic>::Type) -> &'a Atomic<u8>

Source§

impl FromPtr for Atomic<u16>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<u16> as Atomic>::Type, ) -> &'a Atomic<u16>

Source§

impl FromPtr for Atomic<u32>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<u32> as Atomic>::Type, ) -> &'a Atomic<u32>

Source§

impl FromPtr for Atomic<u64>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<u64> as Atomic>::Type, ) -> &'a Atomic<u64>

Source§

impl FromPtr for Atomic<usize>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<usize> as Atomic>::Type, ) -> &'a Atomic<usize>

Source§

impl<T> FromPtr for Atomic<*mut T>

Available on (crate features atomic_from_ptr or since_1_75_0) and non-crate feature loom_atomics only.
Source§

unsafe fn from_ptr<'a>( ptr: *mut <Atomic<*mut T> as Atomic>::Type, ) -> &'a Atomic<*mut T>

Implementors§

Source§

impl<T> FromPtr for AtomicNumber<T>
where T: PrimitiveAtomicNumber + FromPrimitive,