[][src]Macro type_traits::align_of

macro_rules! align_of {
    (*$val:expr) => { ... };
    ($type:ty) => { ... };
    ($val:expr$(,)?) => { ... };
}

Returns minimum alignment of the value at compile time..

Accepts both type and value.

Doesn't work with unsized values

Usage

use type_traits::align_of;
let array = [0u8; 4];
let array_ref = &array;

assert_eq!(align_of!(array[0]), align_of!(u8));
assert_eq!(align_of!(array.len()), align_of!(usize));
assert_eq!(align_of!(array,), align_of!(u8));
assert_eq!(align_of!(*array_ref), align_of!(u8));