bevy/crates
Alice Cecile 509548190b Add get_multiple and get_multiple_mut APIs for Query and QueryState (#4298)
# Objective

- The inability to have multiple active mutable borrows into a query is a common source of borrow-checker pain for users.
- This is a pointless restriction if and only if we can guarantee that the entities they are accessing are unique.
- This could already by bypassed with get_unchecked, but that is an extremely unsafe API.
- Closes https://github.com/bevyengine/bevy/issues/2042.

## Solution

- Add `get_multiple`, `get_multiple_mut` and their unchecked equivalents (`multiple` and `multiple_mut`) to `Query` and `QueryState`.
- Improve the `QueryEntityError` type to provide more useful error information.

## Changelog

- Added `get_multiple`, `get_multiple_mut` and their unchecked equivalents (`multiple` and `multiple_mut`) to Query and QueryState.

## Migration Guide

- The `QueryEntityError` enum now has a `AliasedMutability variant, and returns the offending entity.

## Context

This is a fresh attempt at #3333; rebasing was behaving very badly and it was important to rebase on top of the recent query soundness fixes. Many thanks to all the reviewers in that thread, especially @BoxyUwU for the help with lifetimes.

## To-do

- [x] Add compile fail tests
- [x] Successfully deduplicate code
- [x] Decide what to do about failing doc tests
- [x] Get some reviews for lifetime soundness
2022-03-30 19:16:48 +00:00
..
bevy_app Prevent event from getting registered twice (#4258) 2022-03-20 21:54:10 +00:00
bevy_asset Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_audio Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_core Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_core_pipeline Compute Pipeline Specialization (#3979) 2022-03-23 00:27:26 +00:00
bevy_crevice Add a helper for storage buffers similar to UniformVec (#4079) 2022-03-22 21:23:50 +00:00
bevy_derive bevy_derive: Add derives for Deref and DerefMut (#4328) 2022-03-29 02:10:06 +00:00
bevy_diagnostic Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_dylib Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_dynamic_plugin Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_ecs Add get_multiple and get_multiple_mut APIs for Query and QueryState (#4298) 2022-03-30 19:16:48 +00:00
bevy_ecs_compile_fail_tests Add get_multiple and get_multiple_mut APIs for Query and QueryState (#4298) 2022-03-30 19:16:48 +00:00
bevy_gilrs Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_gltf Mesh Skinning. Attempt #3 (#4238) 2022-03-29 18:31:13 +00:00
bevy_hierarchy Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_input Fix gamepad connection system ordering (#4313) 2022-03-29 22:39:21 +00:00
bevy_internal bevy_derive: Add derives for Deref and DerefMut (#4328) 2022-03-29 02:10:06 +00:00
bevy_log Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_macro_utils Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_math Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_pbr ParamSet for conflicting SystemParam:s (#2765) 2022-03-29 23:39:38 +00:00
bevy_reflect Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_render ParamSet for conflicting SystemParam:s (#2765) 2022-03-29 23:39:38 +00:00
bevy_scene Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_sprite Clean up duplicated color conversion code (#4360) 2022-03-29 23:03:22 +00:00
bevy_tasks CI runs cargo miri test -p bevy_ecs (#4310) 2022-03-25 00:26:07 +00:00
bevy_text ParamSet for conflicting SystemParam:s (#2765) 2022-03-29 23:39:38 +00:00
bevy_transform bevy_transform: Use Changed in the query for much faster transform_propagate_system (#4180) 2022-03-29 03:05:01 +00:00
bevy_ui ParamSet for conflicting SystemParam:s (#2765) 2022-03-29 23:39:38 +00:00
bevy_utils use error scope to handle errors on shader module creation (#3675) 2022-03-29 22:39:14 +00:00
bevy_window Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00
bevy_winit Bump Bevy to 0.7.0-dev (#4230) 2022-03-19 03:54:15 +00:00