bevy/crates
Gino Valente 02fbf16c80 bevy_reflect: Add Reflect::into_reflect (#6502)
# Objective

Using `Reflect` we can easily switch between a specific reflection trait object, such as a `dyn Struct`, to a `dyn Reflect` object via `Reflect::as_reflect` or `Reflect::as_reflect_mut`.

```rust
fn do_something(value: &dyn Reflect) {/* ... */}

let foo: Box<dyn Struct> = Box::new(Foo::default());
do_something(foo.as_reflect());
```

However, there is no way to convert a _boxed_ reflection trait object to a `Box<dyn Reflect>`.

## Solution

Add a `Reflect::into_reflect` method which allows converting a boxed reflection trait object back into a boxed `Reflect` trait object.

```rust
fn do_something(value: Box<dyn Reflect>) {/* ... */}

let foo: Box<dyn Struct> = Box::new(Foo::default());
do_something(foo.into_reflect());
```

---

## Changelog

- Added `Reflect::into_reflect`
2022-11-07 02:11:16 +00:00
..
bevy_animation Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_app Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_asset Fix clippy::iter_with_drain (#6485) 2022-11-06 01:42:15 +00:00
bevy_audio Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_core make register on TypeRegistry idempotent (#6487) 2022-11-05 16:43:15 +00:00
bevy_core_pipeline Add "end of main pass post processing" render graph node (#6468) 2022-11-04 22:19:02 +00:00
bevy_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_diagnostic Add Exponential Moving Average into diagnostics (#4992) 2022-10-24 13:46:37 +00:00
bevy_dylib Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_dynamic_plugin bevy_dynamic_plugin: make it possible to handle loading errors (#6437) 2022-11-01 11:35:44 +00:00
bevy_ecs Fix clippy::iter_with_drain (#6485) 2022-11-06 01:42:15 +00:00
bevy_ecs_compile_fail_tests Fix trybuild tests broken by rust 1.65 (#6457) 2022-11-03 15:09:27 +00:00
bevy_encase_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gilrs feat: add GamepadInfo, expose gamepad names (#6342) 2022-10-24 14:33:50 +00:00
bevy_gltf fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
bevy_hierarchy Fix unsound EntityMut::remove_children. Add EntityMut::world_scope (#6464) 2022-11-04 17:30:40 +00:00
bevy_input Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_internal Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_log Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_macro_utils fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
bevy_math Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_mikktspace Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_pbr Fix clippy::iter_with_drain (#6485) 2022-11-06 01:42:15 +00:00
bevy_ptr Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_reflect bevy_reflect: Add Reflect::into_reflect (#6502) 2022-11-07 02:11:16 +00:00
bevy_render Add CameraRenderGraph::set (#6470) 2022-11-06 17:14:10 +00:00
bevy_scene bevy_reflect: Binary formats (#6140) 2022-11-04 02:22:54 +00:00
bevy_sprite Fix clippy::iter_with_drain (#6485) 2022-11-06 01:42:15 +00:00
bevy_tasks TaskPool Panic Handling (#6443) 2022-11-02 23:40:08 +00:00
bevy_text UI scaling fix (#6479) 2022-11-05 13:51:12 +00:00
bevy_time TaskPool Panic Handling (#6443) 2022-11-02 23:40:08 +00:00
bevy_transform TaskPool Panic Handling (#6443) 2022-11-02 23:40:08 +00:00
bevy_ui Cleaning up NodeBundle, and some slight UI module re-organization (#6473) 2022-11-05 20:48:15 +00:00
bevy_utils Remove Sync bound from Local (#5483) 2022-09-12 04:15:55 +00:00
bevy_window Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
bevy_winit Use new let-else syntax where possible (#6463) 2022-11-04 21:32:09 +00:00