MutGuarded

Trait MutGuarded 

Source
pub trait MutGuarded<'a, T>:
    FastZeroize
    + ZeroizationProbe
    + AssertZeroizeOnDrop{
    // 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 drop

Required Methods§

Source

fn expose(&self) -> &T

Exposes an immutable reference to the guarded value.

Source

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.

Implementors§