assert_zeroize_on_drop

Function assert_zeroize_on_drop 

Source
pub fn assert_zeroize_on_drop<T: AssertZeroizeOnDrop>(value: T)
Expand description

Asserts that a value zeroizes itself when dropped.

This function verifies that the ZeroizeOnDropSentinel of the given value is marked as zeroized after the value is dropped.

§Panics

Panics if the value’s .zeroize() method was not called during drop.

§How It Works

  1. Clones the value’s ZeroizeOnDropSentinel
  2. Resets the sentinel to “not zeroized” state
  3. Drops the value
  4. Asserts the sentinel was marked as zeroized

Typically used in tests for types that implement AssertZeroizeOnDrop.