bevy/crates
Nicola Papale 71a246ce9e Improve QueryIter size_hint hints (#4244)
## Objective

This fixes #1686.

`size_hint` can be useful even if a little niche. For example,
`collect::<Vec<_>>()` uses the `size_hint` of Iterator it collects from
to pre-allocate a memory slice large enough to not require re-allocating
when pushing all the elements of the iterator.

## Solution

To this effect I made the following changes:
* Add a `IS_ARCHETYPAL` associated constant to the `Fetch` trait,
  this constant tells us when it is safe to assume that the `Fetch`
  relies exclusively on archetypes to filter queried entities
* Add `IS_ARCHETYPAL` to all the implementations of `Fetch`
* Use that constant in `QueryIter::size_hint` to provide a more useful

## Migration guide

The new associated constant is an API breaking change. For the user,
if they implemented a custom `Fetch`, it means they have to add this
associated constant to their implementation. Either `true` if it doesn't limit
the number of entities returned in a query beyond that of archetypes, or
`false` for when it does.
2022-04-27 18:02:06 +00:00
..
bevy_animation Public access for AnimationClip.duration (#4615) 2022-04-27 17:37:30 +00:00
bevy_app Document that AppExit can be read by Bevy apps (#4587) 2022-04-25 17:40:44 +00:00
bevy_asset Some minor cleanups of asset_server (#4604) 2022-04-26 20:47:16 +00:00
bevy_audio Converted exclusive systems to parallel systems wherever possible (#2774) 2022-04-25 14:32:56 +00:00
bevy_core Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_core_pipeline Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_crevice Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_derive Misc dependency improvements (#4545) 2022-04-25 13:16:27 +00:00
bevy_diagnostic Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_dylib Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_dynamic_plugin Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_ecs Improve QueryIter size_hint hints (#4244) 2022-04-27 18:02:06 +00:00
bevy_ecs_compile_fail_tests Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_gilrs Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_gltf Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_hierarchy Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_input Update mouse.rs docs in bevy_input (#4518) 2022-04-26 17:32:54 +00:00
bevy_internal Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_log Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_macro_utils Misc dependency improvements (#4545) 2022-04-25 13:16:27 +00:00
bevy_math Document bevy_math (#4591) 2022-04-26 18:23:29 +00:00
bevy_pbr Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_reflect bevy_reflect: Added PartialEq to reflected f32 & f64 (#4217) 2022-04-26 19:41:26 +00:00
bevy_render Fix torus normals (#4520) 2022-04-26 18:42:43 +00:00
bevy_scene Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_sprite Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_tasks Remove unused CountdownEvent (#4290) 2022-04-26 21:20:12 +00:00
bevy_text Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_transform Bump Bevy to 0.8.0-dev (#4505) 2022-04-17 23:04:52 +00:00
bevy_ui Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_utils Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
bevy_window Converted exclusive systems to parallel systems wherever possible (#2774) 2022-04-25 14:32:56 +00:00
bevy_winit Add infallible resource getters for WorldCell (#4104) 2022-04-25 23:19:13 +00:00