Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable lenses to avoid change detection #124

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- `Lens::lerp()` now takes a `&mut dyn Targetable<T>` instead of `&mut T`.
This ensures the lens can skip change detection if needed.
`Targetable<T>` conceptually acts like a `Mut<T>`, but allows encapsulating assets too.
There should be no other change than the function signature to upgrade custom lenses,
because `dyn Targetable<T>` now implements `Defer` and `DeferMut`, so can be used in place of `&mut T`.
- `AssetTarget::new()` now takes a simple `Mut<Assets<T>>` instead of `ResMut<Assets<T>>`.

### Fixed

- Fixed change detection such that lenses which do not dereference their target
do not unconditionally mark that target (component or asset) as changed from the point of view of ECS. (#91)

### Added

- Added `Targetable::target(&self) -> &T`.
- `dyn Targetable<T>` now implements `Defer` and `DeferMut`, so can be used in place of `&T` and `&mut T`.
- Added `ComponentTarget::to_mut(&mut self) -> Mut<'_, T>` to "reborrow" the component target as a `Mut<T>`.

## [0.10.0] - 2024-02-27

### Changed
Expand Down
Loading
Loading