Anders429 / Anders429/brood

`const` checks

Abierto
#49 3 comentarios 0 reacciones 0 asignados Ver en GitHub
C - Enhancement C - Performance P - Low S - Blocked on Rust Feature S - Needs Investigation
Lenguaje dominante
Rust
Estrellas
41
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

There are some checks that can be evaluated at compile time, rather than runtime. These are:

- [x] entity insertion: ensure components are all members of the registry.
- [x] entry add: ensure component is member of registry.
- [x] entry remove: ensure component is member of registry.
- [x] query: ensure components are not borrowed mutably while being borrowed elsewhere within a view.
- [ ] registry: ensure there are no duplicate components.

These are all programmer errors, and should be made known as soon as possible.

These checks can be moved to compile-time using `const fn`s. For example, a check could be run as follows: `const _: () = some_check()`. However, all of these cases will currently require unstable nightly features. Therefore, I think it best to introduce a `unstable_const_checks` feature that requires `nightly`, allowing users to opt-in to these checks instead of the run-time checks.

Related issues: #40 and #27.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.