fix docs for Entity::from_row#21652
Merged
Merged
Conversation
Member
|
https://docs.rs/bevy/latest/bevy/ecs/entity/struct.EntityGeneration.html#associatedconstant.FIRST is public and could be linked to maybe? |
ElliottjPierce
approved these changes
Oct 25, 2025
ElliottjPierce
left a comment
Contributor
There was a problem hiding this comment.
Ooh, nice catch. I forgot to update that.
IMO, we have two options:
- Change docs to say "unspecified" as is done here.
- Specify that it is
EntityGeneration::FIRSTand rename tofirst_id_at_rowor something to reflect it in the name.
Personally, I would prefer the first option, the current implementation, because that gives us the most flexibility and because if anyone cares about what generation they get, they will use from_row_and_generation instead anyway.
Victoronz
approved these changes
Oct 25, 2025
Victoronz
left a comment
Contributor
There was a problem hiding this comment.
I think marking it unspecified is fine for now.
mockersf
approved these changes
Oct 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
The docs state that
Entity::from_rowcreates an entity with a generation of1, which was the case previously. WithEntityinternals being reworked in0.17however, this is no longer the case, as the generation used is nowEntityGeneration::FIRST, currently equivalent to0.Solution
This PR changes the docs to state an "unspecified" generation to allow further changes to implementation without needing another rewrite, as the docs rather consistently refer to
Entity,EntityRow, andEntityGenerationas being opaque identifiers.