Open kstrafe opened 5 years ago
So I agree that having an option to specify the generated structs names would be nice. I don't have a lot of time, but I would welcome a PR implementing it.
Syntax wise, I don't think it is possible to use a proc-macro like this
#[derive(StructOfArray(CheeseVec))]
struct Cheese {
...
}
Instead we would need to do
#[derive(StructOfArray)]
#[soa_derive(vec_name = "CheeseVec")]
struct Cheese {
...
}
However, as of today, the proc macro generate 7 structs from Cheese
: CheeseVec
, CheeseRef
, CheeseMut
, CheeseSlice
, CheeseSliceMut
, CheesePtr
and CheesePtrMut
. So either the could would need all of them to be configurable, or have some kind of prefix to use.
Implicit name generation is something that is very dangerous, and we should almost always use hygienic, correctly scoped macros. So instead of making
CheeseVec
for the following:I instead want to specify the resulting SOA name explicitly: