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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromPtr for AtomicI8

source§

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

source§

impl FromPtr for AtomicI16

source§

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

source§

impl FromPtr for AtomicI32

source§

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

source§

impl FromPtr for AtomicI64

source§

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

source§

impl FromPtr for AtomicIsize

source§

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

source§

impl FromPtr for AtomicU8

source§

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

source§

impl FromPtr for AtomicU16

source§

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

source§

impl FromPtr for AtomicU32

source§

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

source§

impl FromPtr for AtomicU64

source§

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

source§

impl FromPtr for AtomicUsize

source§

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

source§

impl<T> FromPtr for AtomicPtr<T>

source§

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

Implementors§