pub const unsafe fn align_of_val_raw<T>(val: *const T) -> usizewhere
T: ?Sized,
layout_for_ptr #69835)
Returns the ABI-required minimum alignment of the type of the value that val points to in bytes.
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. For the special case where the dynamic tail length is 0, this function is safe to call.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