Skip to content

Commit 10159e6

Browse files
committed
migration guide for combinator systems
1 parent d91d652 commit 10159e6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: System Combinators
3+
pull_requests: [20671]
4+
---
5+
6+
The `CombinatorSystem`s can be used to combine multiple `SystemCondition`s with logical operators. Previously, the conditions would short circuit if the system failed to run, for example because it's query could not be filled by the world.
7+
Now, if a `SystemCondition` fails, it will be considered to have returned `false` and in combinators that don't short circuit the other condition will now be run.
8+
9+
```rust
10+
fn vacant(_: crate::system::Single<&Vacant>) -> bool {
11+
true
12+
}
13+
14+
fn is_true() -> bool {
15+
true
16+
}
17+
18+
assert!(world.query::<&Vacant>().iter(&world).next().is_none());
19+
20+
// previously:
21+
assert!(world.run_system_once(is_true.or(vacant)).is_err());
22+
23+
// now:
24+
assert!(matches!(world.run_system_once(is_true.or(vacant)), Ok(true)));
25+
```

0 commit comments

Comments
 (0)