get-size2 0.11.0

Determine the size in bytes an object occupies inside RAM.
Documentation
1
2
3
4
5
6
7
8
9
10
use crate::GetSize;

// A reference only borrows its data, which belongs to whoever owns it, so all of these report a
// heap size of zero. The `?Sized` bound covers unsized targets as well, e.g. `&[T]`, `&str` and
// `&dyn Trait`.

impl<T: ?Sized> GetSize for &T {}
impl<T: ?Sized> GetSize for &mut T {}
impl<T: ?Sized> GetSize for *const T {}
impl<T: ?Sized> GetSize for *mut T {}