Skip to main content

HeapSize

Trait HeapSize 

Source
pub trait HeapSize {
    // Required method
    fn heap_size(&self) -> usize;
}
Expand description

Trait for calculating the size of various containers

Required Methods§

Source

fn heap_size(&self) -> usize

Return the size of any bytes allocated on the heap by this object, including heap memory in those structures

Note that the size of the type itself is not included in the result – instead, that size is added by the caller (e.g. container).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HeapSize for Arc<dyn HeapSize>

Source§

impl HeapSize for String

Source§

impl HeapSize for bool

Source§

impl HeapSize for f32

Source§

impl HeapSize for f64

Source§

impl HeapSize for i32

Source§

impl HeapSize for i64

Source§

impl HeapSize for u8

Source§

impl HeapSize for usize

Source§

impl<K: HeapSize, V: HeapSize> HeapSize for HashMap<K, V>

Source§

impl<T: HeapSize> HeapSize for Arc<T>

Source§

impl<T: HeapSize> HeapSize for Box<T>

Source§

impl<T: HeapSize> HeapSize for Option<T>

Source§

impl<T: HeapSize> HeapSize for Vec<T>

Implementors§