(Written entirely by me, a human, 100% free of slop)
Codeberg.org
bevy_exclusive_components
bevy_exclusive_components
(Description copied from the README)
A library for running systems that access mutually exclusive entities in parallel with minimal boilerplate.
Example
Imagine a game with 3 kinds of entity, each of which has a position:
#[derive(Component)]
struct Position {
// -- SNIP --
}
#[derive(Component)]
#[require(Position)]
struct Player;
#[derive(Component)]
#[require(Position)]
struct Bat;
#[derive(Component)]
#[require(Position)]
struct Ghost;
And a different movement system for each entity,
the bat flies chaotically,
the ghost slowly phases through walls towards the player,
and the player is controlled by a human.
fn move_player(query: Query<&mut Position, With<Player>) {
// -- SNIP --
}
fn move_bat(query: Query<&mut Position, With<Bat>) {
// -- SNIP --
}
fn move_ghost(query: Query<&mut Position, With<Ghost>) {
// -- SNIP --
}
Depending on how you have bevy configured you will either get a error or warning about conflicting systems,
or the systems will not run in parallel,
To fix this issue you could add more conditions to each query
Query<&mut Position, (With<Player>, Without<Bat>, Without<Ghost>)>
Query<&mut Position, (With<Bat>, Without<Player>, Without<Ghost>)>
Query<&mut Position, (With<Ghost>, Without<Player>, Without<Bat>)>
But that is very annoying to write, and requires updating every queries of every entity when a new entity is added.
With this library you can fix the issue without writing and updating long queries:
exclusive_category!(pub(crate) entity);
add_category!(Player: entity);
add_category!(Bat: entity);
add_category!(Ghost: entity);
Query<&mut Position, Exclusive!(Player: entity)>
Query<&mut Position, Exclusive!(Bat: entity)>
Query<&mut Position, Exclusive!(Ghost: entity)>
Adding a new entity now requires only 1 extra line of boierplate,
and the filter is the same as the long With Without chain from before.
1 post - 1 participant
Read full topic
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Multi_bimap - many-to-many bimap freely made of two arbitrary maps | 0 | 13.1 | 16-10-2026 |
| 2 | Maplike - Crate with traits for abstract containers and operations on them | 2 | 7 | 06-07-2026 |
| 3 | [Project] sol: A self-contained browser kernel written in Rust | 0 | 9.76 | 18-10-2026 |
| 4 | I made a Vibe-Coded Reusable Application Runtime For Any Digital Domain (Office apps, Digital Painter, Graph nodes based apps..etc) | 0 | 17.83 | 12-10-2026 |
| 5 | Multicalc: Scientific computing for real time embedded systems in no_std rust | 0 | 9.4 | 28-07-2026 |
| 6 | Multicalc: Scientific computing for real-time embedded systems in no_std Rust | 0 | 14.36 | 10-08-2026 |
| 7 | Zaxis 0.0.5: immediate-mode GUI on wgpu, embeddable in a host's wgpu pass, with an real overlay layer for other processes | 0 | 10.2 | 11-10-2026 |
| 8 | My state lib PurrGress | 0 | 12.62 | 13-08-2026 |
| 9 | Sping 1.5.5 — a cross-platform network diagnostics CLI written in Rust | 0 | 9.19 | 10-10-2026 |
| 10 | BloomCraft: twelve Bloom filter variants under one API, looking for feedback | 5 | 6 | 06-07-2026 |