redoubt_zero_core/
pointers.rs1use core::ptr;
11
12use crate::traits::{FastZeroizable, ZeroizationProbe, ZeroizeMetadata};
13
14impl<T> ZeroizationProbe for *mut T {
17 #[inline(always)]
18 fn is_zeroized(&self) -> bool {
19 self.is_null()
20 }
21}
22
23impl<T> ZeroizeMetadata for *mut T {
24 const CAN_BE_BULK_ZEROIZED: bool = false;
25}
26
27impl<T> FastZeroizable for *mut T {
28 #[inline(always)]
29 fn fast_zeroize(&mut self) {
30 unsafe {
31 ptr::write_volatile(self, ptr::null_mut());
32 }
33 }
34}
35
36impl<T> ZeroizationProbe for *const T {
39 #[inline(always)]
40 fn is_zeroized(&self) -> bool {
41 self.is_null()
42 }
43}
44
45impl<T> ZeroizeMetadata for *const T {
46 const CAN_BE_BULK_ZEROIZED: bool = false;
47}
48
49impl<T> FastZeroizable for *const T {
50 #[inline(always)]
51 fn fast_zeroize(&mut self) {
52 unsafe {
53 ptr::write_volatile(self, ptr::null());
54 }
55 }
56}