Skip to content
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

Add get_ref to EntityRef #8818

Merged
merged 3 commits into from Jun 13, 2023
Merged

Add get_ref to EntityRef #8818

merged 3 commits into from Jun 13, 2023

Conversation

nicopap
Copy link
Contributor

@nicopap nicopap commented Jun 11, 2023

Objective

To mirror the Ref added as WorldQuery, and the Mut in EntityMut::get_mut, we add EntityRef::get_ref, which retrieves T with tick information, but immutably.

Solution

  • Add the method in question, also add it toUnsafeEntityCell since this seems to be the best way of getting that information.

Also update/add safety comments to neighboring code.


Changelog

  • Add EntityRef::get_ref to get an Option<Ref<T>> from EntityRef

To mirror the `Ref` added as `WorldQuery`, and the `Mut` in
`EntityMut::get_mut`, we add `EntityRef::get_ref`, which retrieves `T`
with tick informations, but *immutably*.
@nicopap nicopap added C-Enhancement A new feature A-ECS Entities, components, systems, and events labels Jun 11, 2023
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Useful. Style is consistent, docs are good, safety comments make sense.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jun 11, 2023
@alice-i-cecile alice-i-cecile removed the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jun 12, 2023
nicopap and others added 2 commits June 12, 2023 21:07
Co-authored-by: James Liu <contact@jamessliu.com>
@james7132 james7132 added this pull request to the merge queue Jun 12, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2023
@mockersf mockersf added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jun 12, 2023
@mockersf mockersf added this pull request to the merge queue Jun 12, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2023
@mockersf mockersf added this pull request to the merge queue Jun 12, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2023
@mockersf mockersf added this pull request to the merge queue Jun 12, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 12, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2023
@mockersf mockersf added this pull request to the merge queue Jun 13, 2023
Merged via the queue into bevyengine:main with commit 019432a Jun 13, 2023
21 checks passed
@nicopap nicopap deleted the entity_ref_ref branch August 30, 2023 13:41
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-Enhancement A new feature S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants