Exclusive systems can now be used for one-shot systems (#11560)

Joy notified me that exclusive systems should now work (they may have
always worked, I don't know), so here's a quick change to the
documentation.
This commit is contained in:
Trashtalk217 2024-01-27 17:10:39 +01:00 committed by GitHub
parent 7da144bc3d
commit a955d65ffa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -145,7 +145,6 @@ impl World {
/// # Limitations
///
/// - Stored systems cannot be recursive, they cannot call themselves through [`Commands::run_system`](crate::system::Commands).
/// - Exclusive systems cannot be used.
///
/// # Examples
///
@ -239,7 +238,6 @@ impl World {
/// # Limitations
///
/// - Stored systems cannot be recursive, they cannot call themselves through [`Commands::run_system`](crate::system::Commands).
/// - Exclusive systems cannot be used.
///
/// # Examples
///
@ -505,6 +503,17 @@ mod tests {
assert_eq!(output, NonCopy(3));
}
#[test]
fn exclusive_system() {
let mut world = World::new();
let exclusive_system_id = world.register_system(|world: &mut World| {
world.spawn_empty();
});
let entity_count = world.entities.len();
let _ = world.run_system(exclusive_system_id);
assert_eq!(world.entities.len(), entity_count + 1);
}
#[test]
fn nested_systems() {
use crate::system::SystemId;