[][src]Function memory_manager::common::assert_aligned

pub fn assert_aligned<T>(mem: *mut u8) -> *mut T

Assert that some memory is properly aligned.

Given an Address, check the alignment, coerce the pointer to *mut T.

Panics

Panics if input is NOT properly aligned for T.

The following use would panic:

This example panics
use memory_manager::common::assert_aligned;
let raw_p = assert_aligned::<usize>(0xDEAD_BEEF as *mut u8);