Skip to content

Commit a171733

Browse files
authored
implement UniqueEntityArray (#17954)
# Objective Continuation of #17589 and #16547. `get_many` is last of the `many` methods with a missing `unique` counterpart. It both takes and returns arrays, thus necessitates a matching `UniqueEntityArray` type! Plus, some slice methods involve returning arrays, which are currently missing from `UniqueEntitySlice`. ## Solution Add the type, the related methods and trait impls. Note that for this PR, we abstain from some methods/trait impls that create `&mut UniqueEntityArray`, because it can be successfully mem-swapped. This can potentially invalidate a larger slice, which is the same reason we punted on some mutable slice methods in #17589. We can follow-up on all of these together in a following PR. The new `unique_array` module is not glob-exported, because the trait alias `unique_array::IntoIter` would conflict with `unique_vec::IntoIter`. The solution for this is to make the various `unique_*` modules public, which I intend to do in yet another PR.
1 parent 1cbaaba commit a171733

File tree

4 files changed

+748
-3
lines changed

4 files changed

+748
-3
lines changed

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ mod unique_slice;
7070

7171
pub use unique_slice::*;
7272

73+
mod unique_array;
74+
75+
pub use unique_array::UniqueEntityArray;
76+
7377
use crate::{
7478
archetype::{ArchetypeId, ArchetypeRow},
7579
change_detection::MaybeLocation,

0 commit comments

Comments
 (0)