Struct parity_util_mem::MallocSizeOfOps
source · [−]pub struct MallocSizeOfOps { /* private fields */ }
Expand description
Operations used when measuring heap usage of data structures.
Implementations
sourceimpl MallocSizeOfOps
impl MallocSizeOfOps
pub fn new(
size_of: unsafe extern "C" fn(ptr: *const c_void) -> usize,
malloc_enclosing_size_of: Option<unsafe extern "C" fn(ptr: *const c_void) -> usize>,
have_seen_ptr: Option<Box<dyn FnMut(*const c_void) -> bool>>
) -> Self
sourcepub unsafe fn malloc_size_of<T: ?Sized>(&self, ptr: *const T) -> usize
pub unsafe fn malloc_size_of<T: ?Sized>(&self, ptr: *const T) -> usize
Call size_of_op
on ptr
, first checking that the allocation isn’t
empty, because some types (such as Vec
) utilize empty allocations.
sourcepub fn has_malloc_enclosing_size_of(&self) -> bool
pub fn has_malloc_enclosing_size_of(&self) -> bool
Is an enclosing_size_of_op
available?
sourcepub unsafe fn malloc_enclosing_size_of<T>(&self, ptr: *const T) -> usize
pub unsafe fn malloc_enclosing_size_of<T>(&self, ptr: *const T) -> usize
Call enclosing_size_of_op
, which must be available, on ptr
, which
must not be empty.
sourcepub fn have_seen_ptr<T>(&mut self, ptr: *const T) -> bool
pub fn have_seen_ptr<T>(&mut self, ptr: *const T) -> bool
Call have_seen_ptr_op
on ptr
.
Auto Trait Implementations
impl !RefUnwindSafe for MallocSizeOfOps
impl !Send for MallocSizeOfOps
impl !Sync for MallocSizeOfOps
impl Unpin for MallocSizeOfOps
impl !UnwindSafe for MallocSizeOfOps
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more