I'm working on a game ECS toy project and am interested in using a lot of compile-time code generation for iteration logic. Ideally I'd like to be able to generate code on individual groups of components, but also generate top-level code based on collections of those component groups. For example,
ecs_world! {
ecs_archetype!(ArchetypeTurret, Position, Health);
ecs_archetype!(ArchetypeVehicle, Position, Velocity, Health);
ecs_archetype!(ArchetypeMine, Position, Duration);
}
Is there a way to nest proc macros like this (where both ecs_world and ecs_archetype are proc macros) but also expand the inner macros during generation? Ideally ecs_archetype would expand to a struct and a couple of traits/functions, and ecs_world would also expand to a bunch of code that stems from reading all of the ecs_archetype definitions and the component structs they are defined with. Any guidance for how to go about this?