pub unsafe fn align_of_val_raw<T>(val: *const T) -> usize where T: ?Sized,
Returns the ABI-required minimum alignment of the type of the value that val
points to.
Every reference to a value of the type T
must be a multiple of this number.
This function is only safe to call if the following conditions hold:
T
is Sized
, this function is always safe to call.T
is: isize
.isize
.align_of_val
on a reference to a type with an extern type tail.#![feature(layout_for_ptr)] use std::mem; assert_eq!(4, unsafe { mem::align_of_val_raw(&5i32) });
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/mem/fn.align_of_val_raw.html