pub unsafe fn read<T>(p: *const T) -> TExpand description
The wrapper of core::ptr::read which panics if the passed pointer is either null or not
aligned.
§Safety
The caller must follow the safety rules required by core::ptr::read except the alignment and null
rules.
§Panics
This function panics if p is either null or not aligned correctly.
§Examples
use aligned_ptr::ptr;
let x = 3;
let p = &x as *const _;
assert_eq!(unsafe { ptr::read(p) }, 3);