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 as_slice to parent #9871

Merged
merged 5 commits into from Sep 22, 2023
Merged

Conversation

iiYese
Copy link
Contributor

@iiYese iiYese commented Sep 20, 2023

Objective

  • Make it possible to write APIs that require a type or homogenous storage for both Children & Parent that is agnostic to edge direction.

Solution

  • Add a way to get the Entity from Parent as a slice.

@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use A-Hierarchy Parent-child entity hierarchies labels Sep 20, 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.

LGTM, but you should probably accept the doc cleanup.

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@iiYese
Copy link
Contributor Author

iiYese commented Sep 20, 2023

Done.

crates/bevy_hierarchy/src/components/parent.rs Outdated Show resolved Hide resolved
Co-authored-by: Joseph <21144246+JoJoJet@users.noreply.github.com>
Copy link
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

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

Bikeshedding here, but get_slice is consistent with get , but perhaps as_slice might be a better naming?

@james7132 james7132 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 Sep 20, 2023
@iiYese iiYese closed this Sep 21, 2023
@iiYese iiYese deleted the Add-get-slice-API-to-Parent branch September 21, 2023 16:17
@iiYese iiYese restored the Add-get-slice-API-to-Parent branch September 21, 2023 16:18
@iiYese iiYese reopened this Sep 21, 2023
@iiYese
Copy link
Contributor Author

iiYese commented Sep 21, 2023

Bikeshedding here, but get_slice is consistent with get , but perhaps as_slice might be a better naming?

Agreed. Follows rust convention.

@iiYese iiYese changed the title Add get slice to parent Add as_slice to parent Sep 21, 2023
@james7132 james7132 added this pull request to the merge queue Sep 22, 2023
Merged via the queue into bevyengine:main with commit 0181d40 Sep 22, 2023
21 checks passed
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
# Objective
- Make it possible to write APIs that require a type or homogenous
storage for both `Children` & `Parent` that is agnostic to edge
direction.

## Solution
- Add a way to get the `Entity` from `Parent` as a slice.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Joseph <21144246+JoJoJet@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Hierarchy Parent-child entity hierarchies C-Usability A simple quality-of-life change that makes Bevy easier to use 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

4 participants