Skip to content

Commit 8e4fd94

Browse files
authored
Refactor memory data (#836)
This refactors the widget state storage introduced by @optozorax in #257 * Unify the four buckets (`data`, `data_temp`, `id_data` and `id_data_temp`) into a single `data`. * Less complexity, and also less chance of error (storing in one bucket, reading from another). * Store data by `Id` and `TypeId`. * Users can thus reuse the same `Id` to store many types. * Uses a simple xor of id and typeid, which is fast and good since both id and typeid are already high-entropy hashes. * Use different suffixes on the functions to pick if you want the data persisted or not (`get_temp`, `insert_persisted`, etc). * Writing with one suffix and reading with the other works. * To store state not bound to a specific `Id` (i.e. only based on type), use the new `Id::null` as the key.
1 parent bbe0f60 commit 8e4fd94

31 files changed

+917
-1347
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
1010
### Added ⭐
1111
* Add context menus: See `Ui::menu_button` and `Response::context_menu` ([#543](https://github.com/emilk/egui/pull/543)).
1212

13+
### Changed 🔧
14+
* Unified the four `Memory` data buckts (`data`, `data_temp`, `id_data` and `id_data_temp`) into a single `Memory::data`, with a new interface ([#836](https://github.com/emilk/egui/pull/836)).
15+
1316

1417
## 0.15.0 - 2021-10-24 - Syntax highlighting and hscroll
1518

egui/src/any/any_map.rs

-224
This file was deleted.

egui/src/any/element.rs

-63
This file was deleted.

egui/src/any/mod.rs

-61
This file was deleted.

0 commit comments

Comments
 (0)