pub struct Inspect<A, F> { /* private fields */ }
Expand description
An allocator that forwards allocation to alloc
and calls the provided closure on each result.
This struct
is created by fallback
method on Allocandrescu
.
See its documentation for more details.
Implementations§
Trait Implementations§
Source§impl<A, F> Allocator for Inspect<A, F>
impl<A, F> Allocator for Inspect<A, F>
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Attempts to allocate a block of memory. Read more
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
Deallocates the memory referenced by
ptr
. Read moreSource§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Behaves like
allocate
, but also ensures that the returned memory is zero-initialized. 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>
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>
Behaves like
grow
, but also ensures that the new contents are set to zero before being
returned. Read moreSource§impl<A, F> ArenaAllocator for Inspect<A, F>
impl<A, F> ArenaAllocator for Inspect<A, F>
Auto Trait Implementations§
impl<A, F> Freeze for Inspect<A, F>
impl<A, F> RefUnwindSafe for Inspect<A, F>where
A: RefUnwindSafe,
F: RefUnwindSafe,
impl<A, F> Send for Inspect<A, F>
impl<A, F> Sync for Inspect<A, F>
impl<A, F> Unpin for Inspect<A, F>
impl<A, F> UnwindSafe for Inspect<A, F>where
A: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<A> Allocandrescu for Awhere
A: Allocator,
impl<A> Allocandrescu for Awhere
A: Allocator,
Source§fn cond<F>(self, pred: F) -> Cond<Self, F>
fn cond<F>(self, pred: F) -> Cond<Self, F>
Combines an allocator with a condition. It allocates only if the condition is met. Read more
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