bevy/crates
Vic c9fb956058 use entity set collections type aliases instead of defaults (#18695)
# Objective

Newest installment of the #16547 series.

In #18319 we introduced `Entity` defaults to accomodate the most common
use case for these types, however that resulted in the switch of the `T`
and `N` generics of `UniqueEntityArray`.
Swapping generics might be somewhat acceptable for `UniqueEntityArray`,
it is not at all acceptable for map and set types, which we would make
generic over `T: EntityEquivalent` in #18408.

Leaving these defaults in place would result in a glaring inconsistency
between these set collections and the others.

Additionally, the current standard in the engine is for "entity" to mean
`Entity`. APIs could be changed to accept `EntityEquivalent`, however
that is a separate and contentious discussion.

## Solution

Name these set collections `UniqueEntityEquivalent*`, and retain the
`UniqueEntity*` name for an alias of the `Entity` case.
While more verbose, this allows for all generics to be in proper order,
full consistency between all set types*, and the "entity" name to be
restricted to `Entity`.
On top of that, `UniqueEntity*` now always have 1 generic less, when
previously this was not enforced for the default case.

*`UniqueEntityIter<I: Iterator<T: EntityEquivalent>>` is the sole
exception to this. Aliases are unable to enforce bounds
(`lazy_type_alias` is needed for this), so for this type, doing this
split would be a mere suggestion, and in no way enforced.
Iterator types are rarely ever named, and this specific one is intended
to be aliased when it sees more use, like we do for the corresponding
set collection iterators.
Furthermore, the `EntityEquivalent` precursor `Borrow<Entity>` was used
exactly because of such iterator bounds!
Because of that, we leave it as is.

While no migration guide for 0.15 users, for those that upgrade from
main:
`UniqueEntityVec<T>` -> `UniqueEntityEquivalentVec<T>`
`UniqueEntitySlice<T>` -> `UniqueEntityEquivalentSlice<T>`
`UniqueEntityArray<N, T>` -> `UniqueEntityEquivalentArray<T, N>`
2025-04-03 21:45:44 +02:00
..
bevy_a11y Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_animation Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_app Add sleep based on spin to bevy_platform_support (#18633) 2025-04-03 21:45:42 +02:00
bevy_asset Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_audio Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_color Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_core_pipeline Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_derive Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_dev_tools Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_diagnostic Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_dylib Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_ecs use entity set collections type aliases instead of defaults (#18695) 2025-04-03 21:45:44 +02:00
bevy_encase_derive Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_gilrs Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_gizmos Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_gltf Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_image Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_input Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_input_focus Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_internal Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_log Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_macro_utils Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_math Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_mesh Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_mikktspace Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_pbr Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_picking Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_platform_support Add sleep based on spin to bevy_platform_support (#18633) 2025-04-03 21:45:42 +02:00
bevy_ptr Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_reflect add reflect for SocketAddr (#18676) 2025-04-03 21:45:43 +02:00
bevy_remote Fix indentation of bevy/query strict parameter in docs (#18681) 2025-04-03 21:45:43 +02:00
bevy_render Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_scene Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_sprite Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_state Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_tasks Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_text Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_time Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_transform Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_ui Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
bevy_utils Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_window Release 0.16.0-rc.3 2025-03-31 23:07:43 +02:00
bevy_winit Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00