Skip to main content

type_bytes

Function type_bytes 

Source
pub unsafe fn type_bytes(metadata: *const c_void) -> usize
Expand description

How many bytes to allocate for a value of this type.

Always the larger of size and stride, and never zero. Sizing a buffer by size alone is a trap: a callee may write the type’s trailing padding, which overruns the allocation. The damage is silent — it corrupts the heap and surfaces much later as an allocator abort in an unrelated call.

§Safety

As type_size.