#[derive(Trackable)]Expand description
Derive macro for automatically implementing the Trackable trait.
This macro generates implementations for:
get_heap_ptr(): Returns the struct’s address for structs with heap allocationsget_type_name(): Returns the type name as a string literalget_size_estimate(): Calculates total size including internal allocationsget_internal_allocations(): Lists all internal heap allocations
§Examples
use memscope_rs::Trackable;
use memscope_derive::Trackable;
#[derive(Trackable)]
struct UserData {
name: String,
scores: Vec<i32>,
metadata: Box<HashMap<String, String>>,
}The macro handles:
- Structs with named fields
- Tuple structs
- Unit structs
- Enums with data
- Nested types that implement
Trackable