Skip to content

Rename bevy_ecs::world::Entry to ComponentEntry #19517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alice-i-cecile
Copy link
Member

Objective

As discussed in #19285, some of our names conflict. Entry in bevy_ecs is one of those overly general names.

Solution

Rename this type (and the related types) to ComponentEntry.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 6, 2025
@alice-i-cecile
Copy link
Member Author

Ping @urben1680 for review :)

Copy link
Contributor

@urben1680 urben1680 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few docs that need to be updated.

I cannot mark everything because it is not close enough to the changes, so here is a list of what I saw in entity_ref.rs:

  • line 2578, just rename "Entry" to "entry", no need to name the whole type when other docs also just call it "entry"
  • line 3025 a comment should be adjusted from "OccupiedEntry" to "OccupiedComponentEntry"
  • line 3081 has `Entry` so that might want to be the correct full type.
  • line 3331 `OccupiedEntry` -> `OccupiedComponentEntry`

}
}
}

impl<'w, 'a, T: Component> Entry<'w, 'a, T> {
impl<'w, 'a, T: Component> ComponentEntry<'w, 'a, T> {
/// Replaces the component of the entry, and returns an [`OccupiedEntry`].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Replaces the component of the entry, and returns an [`OccupiedEntry`].
/// Replaces the component of the entry, and returns an [`OccupiedComponentEntry`].

Entry::Occupied(entry) => entry,
Entry::Vacant(entry) => entry.insert(Default::default()),
ComponentEntry::Occupied(entry) => entry,
ComponentEntry::Vacant(entry) => entry.insert(Default::default()),
}
}
}

/// A view into an occupied entry in a [`EntityWorldMut`]. It is part of the [`Entry`] enum.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A view into an occupied entry in a [`EntityWorldMut`]. It is part of the [`Entry`] enum.
/// A view into an occupied entry in a [`EntityWorldMut`]. It is part of the [`ComponentEntry`] enum.

@@ -3139,12 +3139,12 @@ impl<'w, 'a, T: Component<Mutability = Mutable>> OccupiedEntry<'w, 'a, T> {
}

/// A view into a vacant entry in a [`EntityWorldMut`]. It is part of the [`Entry`] enum.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A view into a vacant entry in a [`EntityWorldMut`]. It is part of the [`Entry`] enum.
/// A view into a vacant entry in a [`EntityWorldMut`]. It is part of the [`ComponentEntry`] enum.

entity_world: &'a mut EntityWorldMut<'w>,
_marker: PhantomData<T>,
}

impl<'w, 'a, T: Component> VacantEntry<'w, 'a, T> {
impl<'w, 'a, T: Component> VacantComponentEntry<'w, 'a, T> {
/// Inserts the component into the `VacantEntry` and returns an `OccupiedEntry`.
Copy link
Contributor

@urben1680 urben1680 Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Inserts the component into the `VacantEntry` and returns an `OccupiedEntry`.
/// Inserts the component into the `VacantComponentEntry` and returns an `OccupiedComponentEntry`.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants