https://github.com/jakobhellermann/bevycheck
https://github.com/jakobhellermann/bevycheck
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/jakobhellermann/bevycheck
- Owner: jakobhellermann
- License: mit
- Created: 2021-03-10T15:46:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-07T20:32:23.000Z (over 3 years ago)
- Last Synced: 2025-04-11T13:17:15.089Z (about 1 year ago)
- Language: Rust
- Size: 43.9 KB
- Stars: 84
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bevycheck
Bevycheck helps debug bevy errors by adding procedural macros which aid the compiler in emitting better compilation errors.
If you get an error like ``the trait `IntoSystem<(), (), _>` is not implemented for fn item `for<'a> fn(bevy::prelude::ResMut<'a, [type error]>) {system}``, simply add `#[bevycheck::system]` to your function, and a more helpful error messages should appear:
```rust
#[bevycheck::system]
fn system(commands: &mut Commands, query: Query<(Entity, &GlobalTransform)>) {
// ...
}
```
## How does it work?
It works by replacing
```rust
fn system(commands: &mut Commands, query: Query<(Entity, &GlobalTransform)>) {
// ...
}
```
with
```rust
fn system() {
assert_is_system_param::<&mut Commands>();
assert_is_system_param::>();
panic!("remove bevycheck before running");
}
```
That way, without parameters the system is a valid system and the `add_system` call doesn't error anymore, and by asserting that each specific parameter must be a valid system param,
rust can figure out which one's the culprit and print a more directed error message.
## Bevy support table
|bevy|bevycheck|
|---|---|
|0.10|0.5|
|0.9|0.4|
|0.7|0.3|
|0.6|0.2|
|0.5|0.1|