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

[Merged by Bors] - Add QueryState::get_single_unchecked_manual and its family #4841

Closed
wants to merge 21 commits into from
Closed

[Merged by Bors] - Add QueryState::get_single_unchecked_manual and its family #4841

wants to merge 21 commits into from

Conversation

Shatur
Copy link
Contributor

@Shatur Shatur commented May 25, 2022

Objective

Solution

  • added functions to QueryState
    • get_single_unchecked_manual
    • get_single_unchecked
    • get_single
    • get_single_mut
    • single
    • single_mut
  • make Query::get_single use QueryState::get_single_unchecked_manual
  • added #[inline]

Changelog

Added

Functions QueryState::single, QueryState::get_single, QueryState::single_mut, QueryState::get_single_mut, QueryState::get_single_unchecked, QueryState::get_single_unchecked_manual.

Changed

QuerySingleError is now in the state module.

Migration Guide

Change query::QuerySingleError to state::QuerySingleError

@Shatur Shatur changed the title Add helpers from Query to QueryState and re-use them Add helpers from Query to QueryState and reuse them May 25, 2022
@Shatur Shatur changed the title Add helpers from Query to QueryState and reuse them Add QueryState::get_single_unchecked_manual and its family May 25, 2022
@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 labels May 26, 2022
@alice-i-cecile
Copy link
Member

This is ready to merge once the lifetimes are fixed.

@alice-i-cecile
Copy link
Member

Going to get one final review from the lifetime crew to verify.

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

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

lifetimes seem reasonable to me, didnt really look at anything other than that

@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 May 27, 2022
@@ -258,7 +258,7 @@ struct QueryIterationCursor<'w, 's, Q: WorldQuery, QF: Fetch<'w, State = Q::Stat
filter: QueryFetch<'w, F>,
current_len: usize,
current_index: usize,
phantom: PhantomData<&'w Q>,
phantom: PhantomData<(&'w (), Q)>,
Copy link
Member

Choose a reason for hiding this comment

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

This change shouldn't be needed; what happens if you remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alice-i-cecile Compilation error that I mentioned in Discord. @BoxyUwU suggested this fix for it.

Copy link
Member

Choose a reason for hiding this comment

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

for future context &'w Q requires Q: 'w to hold which is unnecessary, this change makes that not required

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.

bors r+

bors bot pushed a commit that referenced this pull request May 30, 2022
# Objective

- Rebase of #3159.
- Fixes #3156
- add #[inline] to single related functions so that they matches with other function defs

## Solution

* added functions to QueryState
  *  get_single_unchecked_manual
  *  get_single_unchecked
  *  get_single
  *  get_single_mut
  *  single
  *  single_mut
* make Query::get_single use QueryState::get_single_unchecked_manual
* added #[inline]

---

## Changelog

### Added

Functions `QueryState::single`, `QueryState::get_single`, `QueryState::single_mut`, `QueryState::get_single_mut`, `QueryState::get_single_unchecked`, `QueryState::get_single_unchecked_manual`.

### Changed

`QuerySingleError` is now in the `state` module.

## Migration Guide

Change `query::QuerySingleError` to `state::QuerySingleError`


Co-authored-by: 2ne1ugly <[email protected]>
Co-authored-by: 2ne1ugly <[email protected]>
@bors bors bot changed the title Add QueryState::get_single_unchecked_manual and its family [Merged by Bors] - Add QueryState::get_single_unchecked_manual and its family May 30, 2022
@bors bors bot closed this May 30, 2022
@Shatur Shatur deleted the query-state-single branch May 30, 2022 17:07
james7132 pushed a commit to james7132/bevy that referenced this pull request Jun 7, 2022
…e#4841)

# Objective

- Rebase of bevyengine#3159.
- Fixes bevyengine#3156
- add #[inline] to single related functions so that they matches with other function defs

## Solution

* added functions to QueryState
  *  get_single_unchecked_manual
  *  get_single_unchecked
  *  get_single
  *  get_single_mut
  *  single
  *  single_mut
* make Query::get_single use QueryState::get_single_unchecked_manual
* added #[inline]

---

## Changelog

### Added

Functions `QueryState::single`, `QueryState::get_single`, `QueryState::single_mut`, `QueryState::get_single_mut`, `QueryState::get_single_unchecked`, `QueryState::get_single_unchecked_manual`.

### Changed

`QuerySingleError` is now in the `state` module.

## Migration Guide

Change `query::QuerySingleError` to `state::QuerySingleError`


Co-authored-by: 2ne1ugly <[email protected]>
Co-authored-by: 2ne1ugly <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…e#4841)

# Objective

- Rebase of bevyengine#3159.
- Fixes bevyengine#3156
- add #[inline] to single related functions so that they matches with other function defs

## Solution

* added functions to QueryState
  *  get_single_unchecked_manual
  *  get_single_unchecked
  *  get_single
  *  get_single_mut
  *  single
  *  single_mut
* make Query::get_single use QueryState::get_single_unchecked_manual
* added #[inline]

---

## Changelog

### Added

Functions `QueryState::single`, `QueryState::get_single`, `QueryState::single_mut`, `QueryState::get_single_mut`, `QueryState::get_single_unchecked`, `QueryState::get_single_unchecked_manual`.

### Changed

`QuerySingleError` is now in the `state` module.

## Migration Guide

Change `query::QuerySingleError` to `state::QuerySingleError`


Co-authored-by: 2ne1ugly <[email protected]>
Co-authored-by: 2ne1ugly <[email protected]>
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 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.

Add single() to QueryState
6 participants