I have a struct generated by a macro that looks something like this:
struct MyStruct([ /* determined by macro - known at compile time */ ]);
How can I find the size of the sliced type? It's unsized so I can't use mem::size_of()
, and I can't necessarily construct it because of the unknown type so this doesn't work either: mem::size_of_val(&my_struct.0[0])
to clarify, if the declaration is generated as
struct MyStruct([f32]);
I want to find mem::sizeof::<f32>()