mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
50bc785c8a
# Objective `Ref` is a useful way of accessing change detection data. However, unlike `Mut`, it doesn't expose a constructor or even a way to go from `Ref<A>` to `Ref<B>`. Such methods could be useful, for example, to 3rd party crates that want to expose change detection information in a clean way. My use case is to map a `Ref<T>` into a `Ref<dyn Reflect>`, and keep change detection info to avoid running expansive routines. ## Solution We add the `new` and `map` methods. Since similar methods exist on `Mut` where they are much more footgunny to use, I judged that it was acceptable to create such methods. ## Workaround Currently, it's not possible to create/project `Ref`s. One can define their own `Ref` and implement `ChangeDetection` on it. One would then use `ChangeTrackers` to populate the custom `Ref` with tick data. --- ## Changelog - Added the `Ref::map` and `Ref::new` methods for more ergonomic `Ref`s --------- Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com> |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_macros_compile_fail_tests | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |