Skip to main content

zeroize_flat_type

Function zeroize_flat_type 

Source
pub unsafe fn zeroize_flat_type<F: Sized>(_data: *mut F)
Expand description

Zeroizes a flat type/struct. Only zeroizes the values that it owns, and it does not work on dynamically sized values or trait objects. It would be inefficient to use this function on a type that already implements ZeroizeOnDrop.

ยงSafety

  • The type must not contain references to outside data or dynamically sized data, such as Vec<T> or String.
  • Values stored in the type must not have Drop impls.
  • This function can invalidate the type if it is used after this function is called on it. It is advisable to call this function only in impl Drop.
  • The bit pattern of all zeroes must be valid for the data being zeroized. This may not be true for enums and pointers.