pub struct TrackingAllocator {
    pub allocated: AtomicUsize,
    pub deallocated: AtomicUsize,
}
Expand description

A simple tracking allocator that calls through to Rust’s GlobalAllocator. Note that it tracks the amount of space needed for storing the allocation sizes as well as the actual data.

Fields§

§allocated: AtomicUsize§deallocated: AtomicUsize

Trait Implementations§

source§

impl AllocatorCallback for TrackingAllocator

source§

unsafe extern "C" fn allocate( size: u64, _name: *const c_void, _file: *const c_void, _line: u32, user_data: *const c_void ) -> *mut c_void

Safety Read more
source§

unsafe extern "C" fn deallocate( ptr: *const c_void, user_data: *const c_void )

Safety Read more
source§

unsafe fn into_px(self) -> *mut PxAllocatorCallback

Safety Read more
source§

impl Default for TrackingAllocator

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.