Commit 5e8c33c
authored
# Objective
- Fixes #19681
## Solution
- Implement Map, PartialReflect, Reflect, Typed, FromReflect,
GetTypeRegistration for `indexmap::IndexMap` and `indexmap::IndexSet`
- Add `#[derive(Reflect)]` to `EntityIndexSet`
- Add indexmap feature to `bevy_reflect` and Update docs accordingly
## Testing
- Added test on indexmap::IndexMap
---
I initially tried using `impl_reflect_for_hashmap`, but ran into two
issues:
1. `IndexMap::drain` requires a range parameter, unlike
`HashMap::drain`.
2. `IndexMap::remove` defaults to `swap_remove`, and is now deprecated.
I went with `shift_remove`, since I think it matches user expectations.
That said, it’s `O(n)`, while `swap_remove` is `O(1)`.
Would love feedback on which behavior we should prefer.
1 parent de5bcee commit 5e8c33c
File tree
5 files changed
+538
-5
lines changed- crates
- bevy_ecs
- src/entity
- bevy_reflect
- src
- impls
5 files changed
+538
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
0 commit comments