pub struct MemUsageNode { /* private fields */ }Expand description
A node in a MemUsageTree with children.
Implementations§
Source§impl MemUsageNode
impl MemUsageNode
Sourcepub fn add(&mut self, name: impl Into<String>, child: impl Into<MemUsageTree>)
pub fn add(&mut self, name: impl Into<String>, child: impl Into<MemUsageTree>)
Add a child to this node.
The child’s size will be added to this node’s total size.
pub fn add_named_child(&mut self, tree: NamedMemUsageTree)
pub fn with_named_child(self, tree: NamedMemUsageTree) -> Self
pub fn with_child( self, name: impl Into<String>, child: impl Into<MemUsageTree>, ) -> Self
Sourcepub fn size_bytes(&self) -> u64
pub fn size_bytes(&self) -> u64
Get the total size in bytes of this node and all its children.
Sourcepub fn children(&self) -> &[NamedMemUsageTree]
pub fn children(&self) -> &[NamedMemUsageTree]
Get the children of this node.
Sourcepub fn with_total_size_bytes(self, size_bytes: u64) -> MemUsageTree
pub fn with_total_size_bytes(self, size_bytes: u64) -> MemUsageTree
Set the total size in bytes of this node.
Usually the size is computed automatically when adding children, but this can be used to override it if needed, for instance if we have a more accurate size measurement produced some other way.
Sourcepub fn into_tree(self) -> MemUsageTree
pub fn into_tree(self) -> MemUsageTree
Convert this node into a MemUsageTree::Node.
Trait Implementations§
Source§impl Default for MemUsageNode
impl Default for MemUsageNode
Source§fn default() -> MemUsageNode
fn default() -> MemUsageNode
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemUsageNode
impl RefUnwindSafe for MemUsageNode
impl Send for MemUsageNode
impl Sync for MemUsageNode
impl Unpin for MemUsageNode
impl UnsafeUnpin for MemUsageNode
impl UnwindSafe for MemUsageNode
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