pub(crate) struct CountingAllocator<A> {
inner: A,
enabled: AtomicBool,
count: AtomicU64,
bytes: AtomicU64,
}Expand description
Transparent counting wrapper around Forge’s existing allocator.
Fields§
§inner: A§enabled: AtomicBool§count: AtomicU64§bytes: AtomicU64Implementations§
Trait Implementations§
Source§impl<A> GlobalAlloc for CountingAllocator<A>where
A: GlobalAlloc,
impl<A> GlobalAlloc for CountingAllocator<A>where
A: 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 moreSource§unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
Behaves like
alloc, but also ensures that the contents
are set to zero before being returned. Read moreAuto Trait Implementations§
impl<A> !Freeze for CountingAllocator<A>
impl<A> RefUnwindSafe for CountingAllocator<A>where
A: RefUnwindSafe,
impl<A> Send for CountingAllocator<A>where
A: Send,
impl<A> Sync for CountingAllocator<A>where
A: Sync,
impl<A> Unpin for CountingAllocator<A>where
A: Unpin,
impl<A> UnsafeUnpin for CountingAllocator<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for CountingAllocator<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
§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