Skip to content

Commit c6cb619

Browse files
rename ComponentIdDictator
1 parent 972b8a3 commit c6cb619

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

crates/bevy_ecs/macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream {
134134
// - `Bundle::get_components` is exactly once for each member. Rely's on the Component -> Bundle implementation to properly pass
135135
// the correct `StorageType` into the callback.
136136
unsafe impl #impl_generics #ecs_path::bundle::Bundle for #struct_name #ty_generics #where_clause {
137-
fn component_ids<Components: #ecs_path::component::ComponentIdDictator>(
137+
fn component_ids<Components: #ecs_path::component::DetermineComponentIds>(
138138
components: &mut Components,
139139
) -> impl Iterator<Item = #ecs_path::component::ComponentId> + use<#(#generics_ty_list,)* Components> {
140140
core::iter::empty()#(.chain(<#active_field_types as #ecs_path::bundle::Bundle>::component_ids(components)))*

crates/bevy_ecs/src/bundle/impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ use variadics_please::all_tuples_enumerated;
66

77
use crate::{
88
bundle::{Bundle, BundleFromComponents, DynamicBundle, NoBundleEffect},
9-
component::{Component, ComponentId, ComponentIdDictator, Components, StorageType},
9+
component::{Component, ComponentId, Components, DetermineComponentIds, StorageType},
1010
world::EntityWorldMut,
1111
};
1212

1313
// SAFETY:
1414
// - `Bundle::component_ids` calls `ids` for C's component id (and nothing else)
1515
// - `Bundle::get_components` is called exactly once for C and passes the component's storage type based on its associated constant.
1616
unsafe impl<C: Component> Bundle for C {
17-
fn component_ids<Components: ComponentIdDictator>(
17+
fn component_ids<Components: DetermineComponentIds>(
1818
components: &mut Components,
1919
) -> impl Iterator<Item = ComponentId> + use<C, Components> {
2020
iter::once(components.determine_component_id_of::<C>())
@@ -73,7 +73,7 @@ macro_rules! tuple_impl {
7373
// - `Bundle::get_components` is called exactly once for each member. Relies on the above implementation to pass the correct
7474
// `StorageType` into the callback.
7575
unsafe impl<$($name: Bundle),*> Bundle for ($($name,)*) {
76-
fn component_ids<'a, Components: ComponentIdDictator>(components: &'a mut Components) -> impl Iterator<Item = ComponentId> + use<$($name,)* Components> {
76+
fn component_ids<'a, Components: DetermineComponentIds>(components: &'a mut Components) -> impl Iterator<Item = ComponentId> + use<$($name,)* Components> {
7777
iter::empty()$(.chain(<$name as Bundle>::component_ids(components)))*
7878
}
7979

crates/bevy_ecs/src/bundle/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub use info::*;
7777
pub use bevy_ecs_macros::Bundle;
7878

7979
use crate::{
80-
component::{ComponentId, ComponentIdDictator, Components, StorageType},
80+
component::{ComponentId, Components, DetermineComponentIds, StorageType},
8181
world::EntityWorldMut,
8282
};
8383
use bevy_ptr::OwningPtr;
@@ -204,9 +204,9 @@ use bevy_ptr::OwningPtr;
204204
)]
205205
pub unsafe trait Bundle: DynamicBundle + Send + Sync + 'static {
206206
/// Gets this [`Bundle`]'s component ids, in the order of this bundle's [`Component`]s
207-
/// This may register the component if it doesn't exist, depending on which [`ComponentIdDictator`] is used.
207+
/// This may register the component if it doesn't exist, depending on which [`DetermineComponentIds`] is used.
208208
#[doc(hidden)]
209-
fn component_ids<Components: ComponentIdDictator>(
209+
fn component_ids<Components: DetermineComponentIds>(
210210
components: &mut Components,
211211
) -> impl Iterator<Item = ComponentId> + use<Self, Components>;
212212

crates/bevy_ecs/src/component/register.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,20 +703,20 @@ impl<'w> ComponentsQueuedRegistrator<'w> {
703703
///
704704
/// This exists to encapsulate shared behavior of [`ComponentsRegistrator`] and [`ComponentsQueuedRegistrator`].
705705
/// If you know which one you are working with, prefer their direct methods.
706-
pub trait ComponentIdDictator {
706+
pub trait DetermineComponentIds {
707707
/// Determines the [`ComponentId`] of `T`.
708708
/// This makes no promises of whether or not `T` will be full registered; it just gets its id.
709709
fn determine_component_id_of<T: Component>(&mut self) -> ComponentId;
710710
}
711711

712-
impl ComponentIdDictator for ComponentsRegistrator<'_> {
712+
impl DetermineComponentIds for ComponentsRegistrator<'_> {
713713
#[inline]
714714
fn determine_component_id_of<T: Component>(&mut self) -> ComponentId {
715715
self.register_component::<T>()
716716
}
717717
}
718718

719-
impl ComponentIdDictator for ComponentsQueuedRegistrator<'_> {
719+
impl DetermineComponentIds for ComponentsQueuedRegistrator<'_> {
720720
#[inline]
721721
fn determine_component_id_of<T: Component>(&mut self) -> ComponentId {
722722
self.queue_register_component::<T>()

crates/bevy_ecs/src/spawn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ pub struct SpawnRelatedBundle<R: Relationship, L: SpawnableList<R>> {
298298
unsafe impl<R: Relationship, L: SpawnableList<R> + Send + Sync + 'static> Bundle
299299
for SpawnRelatedBundle<R, L>
300300
{
301-
fn component_ids<Components: crate::component::ComponentIdDictator>(
301+
fn component_ids<Components: crate::component::DetermineComponentIds>(
302302
components: &mut Components,
303303
) -> impl Iterator<Item = crate::component::ComponentId> + use<R, L, Components> {
304304
<R::RelationshipTarget as Bundle>::component_ids(components)
@@ -388,7 +388,7 @@ impl<R: Relationship, B: Bundle> DynamicBundle for SpawnOneRelated<R, B> {
388388

389389
// SAFETY: This internally relies on the RelationshipTarget's Bundle implementation, which is sound.
390390
unsafe impl<R: Relationship, B: Bundle> Bundle for SpawnOneRelated<R, B> {
391-
fn component_ids<Components: crate::component::ComponentIdDictator>(
391+
fn component_ids<Components: crate::component::DetermineComponentIds>(
392392
components: &mut Components,
393393
) -> impl Iterator<Item = crate::component::ComponentId> + use<R, B, Components> {
394394
<R::RelationshipTarget as Bundle>::component_ids(components)

crates/bevy_ui_widgets/src/observe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ unsafe impl<
2525
> Bundle for AddObserver<E, B, M, I>
2626
{
2727
#[inline]
28-
fn component_ids<Components: bevy_ecs::component::ComponentIdDictator>(
28+
fn component_ids<Components: bevy_ecs::component::DetermineComponentIds>(
2929
_components: &mut Components,
3030
) -> impl Iterator<Item = bevy_ecs::component::ComponentId> + use<E, B, M, I, Components> {
3131
// SAFETY: Empty iterator

release-content/migration-guides/bundle_traits.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: Bundle Traits
33
pull_requests: [22670]
44
---
55

6-
The function `Bundle::component_ids` is now generic over `Components: ComponentIdDictator`.
7-
The `ComponentIdDictator` is implemented for the old `ComponentsRegistrator` and `ComponentsQueuedRegistrator`.
6+
The function `Bundle::component_ids` is now generic over `Components: DetermineComponentIds`.
7+
The `DetermineComponentIds` is implemented for the old `ComponentsRegistrator` and `ComponentsQueuedRegistrator`.
88
Additionally, because [this rust rfc](https://github.com/rust-lang/rust/issues/130043) is not yet stable, the `use<Self>` had to be extended to `use<Self, Components>`.
99
This may cause some lifetime annoyances but nothing a `SmallVec` can't fix.
1010
This was done to allow bundles to work with queued component registration.

0 commit comments

Comments
 (0)