Crates.io | struct_scalpel |
lib.rs | struct_scalpel |
version | 0.1.1 |
source | src |
created_at | 2023-07-01 22:42:20.99167 |
updated_at | 2023-07-01 22:44:41.350402 |
description | memory layout analysis tool for structs, enums, unions, tuples, and references |
homepage | |
repository | https://github.com/DragonFighter603/struct_scalpel |
max_upload_size | |
id | 905754 |
size | 84,776 |
Memory layout analysis tool for rust structs, enums, unions, tuples, and references, prints to console using ansi escape codes.
Simply derive Dissectible
and call print_dissection_info
to get a well formatted overview.
use struct_scalpel::{Dissectible, print_dissection_info};
#[derive(Dissectible)]
struct Person {
name: String,
age: u32,
is_student: bool,
height: f64,
favorite_numbers: Vec<u8>,
}
fn main() {
print_dissection_info::<Person>();
}
With dissect_std
you can even disect some std items, with only a few type path deviations for private types.
Disclaimer: This may not work in all cases, such as where some fields are unsized or dependant on a sys (os) implementation
This also works with generics and different layout strategies