Skip to content

A rust crate to find the total size of an object, on the stack and on the heap

License

Notifications You must be signed in to change notification settings

raygon-renderer/deepsize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deepsize

A trait and derive macro to recursively find the size of an object and the size of allocations that it owns.

This has can work in #[no_std] environments, but requires the alloc crate.

Example Code

use deepsize::DeepSizeOf;

#[derive(DeepSizeOf)]
struct Test {
    a: u32,
    b: Box<u8>,
}

fn main() {
    let object = Test {
        a: 15,
        b: Box::new(255),
    };
    
    assert_eq!(object.deep_size_of(), 17);
}

About

A rust crate to find the total size of an object, on the stack and on the heap

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%