bubblezone
bubblezone copied to clipboard
Add AnyInBoundsAndUpdate
๐ Changes proposed by this PR
AnyInBounds discards the results of Update(). This makes it useless for value-based models, and doesn't let us use it to trigger tea.Cmds.
This PR adds AnyInBoundsAndUpdate (I'm not tied to the name); which doesn't discard the results of Update(), instead carrying updates to the model through the events, and returning the final tea.Model and resulting tea.Cmds.
I also refactored a bit to share the logic between these two functions, and changed said factored-out code to reduce allocations a bit.
๐งฐ Type of change
- [x] New feature (non-breaking change which adds functionality).
๐ค Requirements
- [x] โ I have read and agree to this projects Code of Conduct.
- [x] โ I have read and agree to this projects Contribution Guidelines.
- [x] โ I have read and agree to the Developer Certificate of Origin.
- [x] ๐ I have performed a self-review of my own changes.
- [x] ๐จ My changes follow the style guidelines of this project.
- [x] ๐ฌ My changes as properly commented, primarily for hard-to-understand areas.
- [x] ๐ I have made corresponding changes to the documentation.
- [x] ๐งช I have included tests (if necessary) for this change.