MemoryReport

Trait MemoryReport 

Source
pub trait MemoryReport: Sized {
    const ALLOC: bool = false;
    const CHILD: bool = false;

    // Provided methods
    fn direct() -> usize { ... }
    fn indirect(&self) -> usize { ... }
    fn children(&self) -> usize { ... }
}

Provided Associated Constants§

Source

const ALLOC: bool = false

A constant that indicates whether this object allocates memory other than the innate memory.

Source

const CHILD: bool = false

A constant that indicates whether this object has children.

Provided Methods§

Source

fn direct() -> usize

Reports the memory innate to the struct. This is equivalent to core::mem::size_of::<Self>().

Source

fn indirect(&self) -> usize

Reports the memory directly allocated by this struct. For example, Vec returns its capacity times the size of the structs.

Source

fn children(&self) -> usize

Reports the indirect and children memory of the children of the struct, if there are any. This returns non zero only if the children of the struct allocate memory. For example Vec<Vec<T>> would return a non zero value but a Vec<usize> would return 0.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl MemoryReport for &str

Source§

const ALLOC: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl MemoryReport for bool

Source§

impl MemoryReport for char

Source§

impl MemoryReport for f32

Source§

impl MemoryReport for f64

Source§

impl MemoryReport for i8

Source§

impl MemoryReport for i16

Source§

impl MemoryReport for i32

Source§

impl MemoryReport for i64

Source§

impl MemoryReport for i128

Source§

impl MemoryReport for isize

Source§

impl MemoryReport for u8

Source§

impl MemoryReport for u16

Source§

impl MemoryReport for u32

Source§

impl MemoryReport for u64

Source§

impl MemoryReport for u128

Source§

impl MemoryReport for usize

Source§

impl MemoryReport for String

Source§

const ALLOC: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<K: MemoryReport, V: MemoryReport> MemoryReport for BTreeMap<K, V>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

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

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for &[T]

Source§

const ALLOC: bool = false

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for &T

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for BinaryHeap<T>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for BTreeSet<T>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for LinkedList<T>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for VecDeque<T>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for Vec<T>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport> MemoryReport for HashSet<T>

Source§

const ALLOC: bool = true

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Source§

impl<T: MemoryReport, const N: usize> MemoryReport for &[T; N]

Source§

const ALLOC: bool = false

Source§

const CHILD: bool = true

Source§

fn indirect(&self) -> usize

Source§

fn children(&self) -> usize

Implementors§