Struct servo_malloc_size_of::MallocSizeOfOps
source · 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