Struct ZeroizingAllocator
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: Alloc
Trait Implementations§
§impl<T> GlobalAlloc for ZeroizingAllocator<T>where
T: GlobalAlloc,
impl<T> GlobalAlloc for ZeroizingAllocator<T>where
T: GlobalAlloc,
§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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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