-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Can something like this be allowed?
#[derive(SplitFields)]
enum AiType {
Crawler,
Shooter { some_data: i64 },
}
#[derive(SplitFields)]
struct Unit {
#[split(nested)]
ai_type: AiType,
// other fields
}Perhaps it could be represented as:
#[derive(SplitFields)]
struct AiTypeCrawler {}
#[derive(SplitFields)]
struct AiTypeShooter {
some_data: i64,
}
struct AiTypeStructOf<F: StorageFamily> {
Crawler: F::Storage<Option<AiTypeCrawler::StructOf<F>>>,
Shooter: F::Storage<Option<AiTypeShooter::StructOf<F>>>,
}And then queries could look like:
for (pos, crawler_ai) in query!(world.units, (&position, &ai_type.Crawler.Get.Some)) { }Thought, ideally, .Get.Some could be omitted since it is already implied by the enum.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request