bevy/crates/bevy_ecs/src
Tristan Guichaoua cfb65c1eaf
Add replace_if_neq to DetectChangesMut (#9418)
# Objective

Just like
[`set_if_neq`](https://docs.rs/bevy_ecs/latest/bevy_ecs/change_detection/trait.DetectChangesMut.html#method.set_if_neq),
being able to express the "I don't want to unnecessarily trigger the
change detection" but with the ability to handle the previous value if
change occurs.

## Solution

Add `replace_if_neq` to `DetectChangesMut`.

---

## Changelog

- Added `DetectChangesMut::replace_if_neq`: like `set_if_neq` change the
value only if the new value if different from the current one, but
return the previous value if the change occurs.
2023-08-11 21:10:16 +00:00
..
entity Add EntityMap::clear (#9291) 2023-07-31 22:02:16 +00:00
query Fix safety invariants for WorldQuery::fetch and simplify cloning (#8246) 2023-07-25 21:16:22 +00:00
reflect Fix typos throughout the project (#9090) 2023-07-10 00:11:51 +00:00
schedule Fix ambiguous_with breaking run conditions (#9253) 2023-08-03 07:53:20 +00:00
storage Fix typos throughout the project (#9090) 2023-07-10 00:11:51 +00:00
system Add RunSystem (#9366) 2023-08-11 20:41:48 +00:00
world delete code deprecated in 0.11 (#9128) 2023-07-13 23:35:06 +00:00
archetype.rs Fix typo in Archetypes documentation (#8990) 2023-06-28 19:33:18 +00:00
bundle.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
change_detection.rs Add replace_if_neq to DetectChangesMut (#9418) 2023-08-11 21:10:16 +00:00
component.rs Derive Eq, PartialEq for Tick (#9020) 2023-07-04 19:08:51 +00:00
event.rs Derive debug for ManualEventIterator (#9293) 2023-07-30 15:30:52 +00:00
lib.rs Add the Has world query to bevy_ecs::prelude (#9204) 2023-07-19 11:54:40 +00:00
removal_detection.rs Simplify the ComponentIdFor type (#8845) 2023-06-15 12:57:47 +00:00