pub struct MallocSizeOfOps {
pub(crate) size_of_op: unsafe extern "C" fn(*const c_void) -> usize,
pub(crate) enclosing_size_of_op: Option<unsafe extern "C" fn(*const c_void) -> usize>,
pub(crate) have_seen_ptr_op: Option<Box<dyn FnMut(*const c_void) -> bool>>,
}Expand description
Operations used when measuring heap usage of data structures.
Fields§
§size_of_op: unsafe extern "C" fn(*const c_void) -> usize§enclosing_size_of_op: Option<unsafe extern "C" fn(*const c_void) -> usize>§have_seen_ptr_op: Option<Box<dyn FnMut(*const c_void) -> bool>>Implementations§
Source§impl MallocSizeOfOps
impl MallocSizeOfOps
pub fn new( size_of: unsafe extern "C" fn(*const c_void) -> usize, malloc_enclosing_size_of: Option<unsafe extern "C" fn(*const c_void) -> usize>, have_seen_ptr: Option<Box<dyn FnMut(*const c_void) -> bool>>, ) -> MallocSizeOfOps
Sourcepub unsafe fn malloc_size_of<T>(&self, ptr: *const T) -> usizewhere
T: ?Sized,
pub unsafe fn malloc_size_of<T>(&self, ptr: *const T) -> usizewhere
T: ?Sized,
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 Freeze for MallocSizeOfOps
impl !RefUnwindSafe for MallocSizeOfOps
impl !Send for MallocSizeOfOps
impl !Sync for MallocSizeOfOps
impl Unpin for MallocSizeOfOps
impl !UnwindSafe for MallocSizeOfOps
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
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert