Macro bench_utils::generate_nested_struct
source · generate_nested_struct!() { /* proc-macro */ }
Expand description
Creates a struct with deeply-nested fields. For example:
use bench_utils::generate_nested_struct;
generate_nested_struct!(foo: NestedStruct<[i32; 3]> = 1);
generates 3 structs for each “level” of the nesting, with 3 fields each:
struct struct_1 {
field_1: i32,
// ...
}
struct struct_2 {
field_1: struct_1,
// ...
}
struct struct_3 {
field_1: struct_2,
// ...
}
the macro then instantiates each level of the tree, resulting in a final struct
with nⁿ i32
fields.