Skip to main content

SecureSanitizeOnDrop

Derive Macro SecureSanitizeOnDrop 

Source
#[derive(SecureSanitizeOnDrop)]
{
    // Attributes available to this derive:
    #[sanitization]
}
Expand description

Derive Drop by calling sanitization::SecureSanitize::secure_sanitize.

§Generics

For structs with type parameters that hold sanitizable data, the parameter must carry the SecureSanitize bound at the type declaration:

use sanitization::SecureSanitize;

#[derive(SecureSanitize, SecureSanitizeOnDrop)]
struct Wrapper<T: SecureSanitize> {
    inner: T,
}

This is a Rust Drop restriction: the generated Drop impl cannot add a stricter T: SecureSanitize bound than the struct declaration itself.