pub struct ZeroizingAllocator<Alloc>(pub Alloc)
where
Alloc: GlobalAlloc;Expand description
Custom allocator that zeroizes memory before deallocating it
This is highly recommended to be enabled when using the Bitwarden crates to avoid sensitive data persisting in memory after it has been deallocated.
This allocator is a decorator around another allocator.
§Example
This example shows how to use the ZeroizingAllocator with the system allocator.
ⓘ
#[global_allocator]
static ALLOC: bitwarden_crypto::ZeroizingAllocator<std::alloc::System> =
bitwarden_crypto::ZeroizingAllocator(std::alloc::System);Tuple Fields§
§0: AllocTrait Implementations§
Source§impl<T> GlobalAlloc for ZeroizingAllocator<T>where
T: GlobalAlloc,
impl<T> GlobalAlloc for ZeroizingAllocator<T>where
T: GlobalAlloc,
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl<Alloc> Freeze for ZeroizingAllocator<Alloc>where
Alloc: Freeze,
impl<Alloc> RefUnwindSafe for ZeroizingAllocator<Alloc>where
Alloc: RefUnwindSafe,
impl<Alloc> Send for ZeroizingAllocator<Alloc>where
Alloc: Send,
impl<Alloc> Sync for ZeroizingAllocator<Alloc>where
Alloc: Sync,
impl<Alloc> Unpin for ZeroizingAllocator<Alloc>where
Alloc: Unpin,
impl<Alloc> UnwindSafe for ZeroizingAllocator<Alloc>where
Alloc: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more