forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more flexible version of
set_if_neq
In one of my personal projects I stumbled across a case where I wanted to be cautious with the change detection while also not sacraficing any performance. My use case: I basically have a horizontal surface which is saved as a collection of `Vec<Vec2>` in a component. The component also includes a height field. Now when the height is updated there only have two (three) options: - The collection of points can be cloned so the existing `set_if_neq` is usable - The `set_if_neq` code can be inlined and adjusted for this special case - (The component can be split up into two more granular components) I have to acknowledge that the third point here is probably the way to go in most cases, but I was curious: - if it would be possible to have a more flexible API and how that would look like - if you are interested in this change in general No hard feelings if we just end up rejecting this PR. I'm also totally fine with this. But maybe it's useful to anyone and I just wanted to hear your feedback first before tossing this back into the void and forgetting about it.
- Loading branch information
Showing
1 changed file
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters