Function aligned_ptr::ptr::read_volatile[][src]

pub unsafe fn read_volatile<T>(p: *const T) -> T
Expand description

The wrapper of core::ptr::read_volatile 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_volatile except the alignment and null rules.

Examples

use aligned_ptr::ptr;

let x = 3;
let p = &x as *const _;

assert_eq!(unsafe { ptr::read_volatile(p) }, 3);