pub struct ZeroizeAlloc<A> { /* private fields */ }
Expand description
Wrapper around an allocator which zeroizes memory on deallocation. See the module level documentation.
If debug assertions are enabled, some of the safety requirement for using an allocator are checked.
Implementations§
Source§impl<A> ZeroizeAlloc<A>
impl<A> ZeroizeAlloc<A>
Trait Implementations§
Source§impl<A: Allocator> Allocator for ZeroizeAlloc<A>
impl<A: Allocator> Allocator for ZeroizeAlloc<A>
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Attempts to allocate a block of memory. Read more
Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Behaves like
allocate
, but also ensures that the returned memory is zero-initialized. Read moreSource§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (
allocator_api
)Deallocates the memory referenced by
ptr
. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Attempts to extend the memory block. Read more
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api
)Behaves like
grow
, but also ensures that the new contents are set to zero before being
returned. Read moreSource§impl<A: Debug> Debug for ZeroizeAlloc<A>
impl<A: Debug> Debug for ZeroizeAlloc<A>
Source§impl<A: Default> Default for ZeroizeAlloc<A>
impl<A: Default> Default for ZeroizeAlloc<A>
Source§fn default() -> ZeroizeAlloc<A>
fn default() -> ZeroizeAlloc<A>
Returns the “default value” for a type. Read more
Source§impl<A: GlobalAlloc> GlobalAlloc for ZeroizeAlloc<A>
impl<A: GlobalAlloc> GlobalAlloc for ZeroizeAlloc<A>
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<A> Freeze for ZeroizeAlloc<A>where
A: Freeze,
impl<A> RefUnwindSafe for ZeroizeAlloc<A>where
A: RefUnwindSafe,
impl<A> Send for ZeroizeAlloc<A>where
A: Send,
impl<A> Sync for ZeroizeAlloc<A>where
A: Sync,
impl<A> Unpin for ZeroizeAlloc<A>where
A: Unpin,
impl<A> UnwindSafe for ZeroizeAlloc<A>where
A: 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