pub trait MutGuarded<'a, T>:
FastZeroize
+ ZeroizationProbe
+ AssertZeroizeOnDropwhere
T: FastZeroize + ZeroizationProbe,{
// Required methods
fn expose(&self) -> &T;
fn expose_mut(&mut self) -> &mut T;
}Expand description
Trait for mutable guards that auto-zeroize on drop.
Types implementing this trait wrap a mutable reference &mut T and
provide controlled access while ensuring zeroization on drop.
§Example
ⓘ
use redoubt_zero_core::{MutGuarded, ZeroizingMutGuard};
fn process_guarded<'a, T: MutGuarded<'a, SomeType>>(guard: &mut T) {
let value = guard.expose_mut();
// ... use value
} // guard zeroizes on dropRequired Methods§
Sourcefn expose_mut(&mut self) -> &mut T
fn expose_mut(&mut self) -> &mut T
Exposes a mutable reference to the guarded value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.