Function allocative::size_of_unique
source · pub fn size_of_unique<T>(root: &T) -> usizewhere
T: Allocative,
Expand description
Size of a piece of data and data allocated in unique pointers in the struct.
- Excludes shared pointers
§Example
use allocative::Allocative;
#[derive(Allocative)]
struct Foo {
data: Vec<u8>,
}
assert_eq!(
3 + std::mem::size_of::<Vec<u8>>(),
allocative::size_of_unique(&Foo {
data: vec![10, 20, 30]
})
);