Skip to main content

assert_ptr_cast_valid

Function assert_ptr_cast_valid 

Source
pub const fn assert_ptr_cast_valid<Src, Dst>(_ptr: *const Src)
Expand description

Asserts at compile time that casting from Src to Dst is size-and-alignment compatible.

The target element size must be a multiple of the source element size (covers both same-size type conversions and array-grouping casts like *const f64 to *const [f64; 3]), and the source and target alignments must be equal.

The pointer argument is only used for type inference of Src; it is never dereferenced.