bubblezone icon indicating copy to clipboard operation
bubblezone copied to clipboard

Add AnyInBoundsAndUpdate

Open ThisGuyCodes opened this issue 2 years ago โ€ข 0 comments

๐Ÿš€ 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.

ThisGuyCodes avatar Feb 25 '23 19:02 ThisGuyCodes