memusage 0.2.0

Small trait utility to keep track of the memory usage of structs
Documentation
//! Implementation of `MemoryReport` for pointer and reference types.



use crate::MemoryReport;



impl<T: MemoryReport> MemoryReport for &T {
    const ALLOC: bool = true;
    const CHILD: bool = true;

    fn indirect(&self) -> usize {
        T::direct()
    }

    fn children(&self) -> usize {
        if T::ALLOC || T::CHILD {
            let target: &T = self;

            target.indirect() + target.children()
        } else {
            0
        }
    }
}