Investigate reimplementing adding and removing components without `TypeId` checks
- Lingua principale
- Rust
- Stelle
- 41
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Using heterogeneous list tricks, we should be able to remove the dynamic type checking in these two spots:
- https://github.com/Anders429/brood/blob/master/src/registry/sealed/storage.rs#L644
- https://github.com/Anders429/brood/blob/master/src/registry/sealed/storage.rs#L754
Instead, these can be checked at the type level using a trait with indices. Basically, we can first do a `Get` on the trait (with some `ComponentIndices`), and then from there we can run through the rest of the list using the same trait by using a `NullIndices`. The difference between the two indices types will be that `ComponentIndices` can use `Index` for its end type, while `NullIndices` will use `Null` for its end type.
This will also, I believe, remove the need for the run-time check on registry value uniqueness, since `push_components_from_buffer_and_component` is the only place that I believe *requires* uniqueness. I will need to double-check this. Most every use of a non-unique component should fail to compile anyway, since the indices won't be able elideable. If this is indeed the case, the entire check [here](https://github.com/Anders429/brood/blob/master/src/world/mod.rs#L151-L154) can be removed, and #49 will be able to be closed.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.