bevy/crates
Gino Valente 1674938c49
bevy_reflect: Split up the std module (#18939)
> [!important]
> To **maintainers**: we should wait to merge this one in until after
#18944 lands so that cherry-picking the latter for 0.16.1 is simpler.

# Objective

The `std` module is where we implement the reflection traits for types
that are exported from `std` (including `core` and `alloc`). Over time,
this file has grown increasingly large, making it difficult to navigate
and a pain point for merge conflicts.

The goal of this PR is to break up the module into smaller chunks.

## Solution

The `std` module has been split into many submodules:
- `alloc`
- `bevy_platform`
- `core`
- `std`

Each of these new modules is comprised of submodules that closely
resemble the actual module. For example, the impls for
`::alloc::vec::Vec` have been moved to
`bevy_reflect::impls::alloc::vec::Vec`.

Some liberties were taken. For example, `Cow<'static, Path>` was kept in
`bevy_reflect::impls::std::path` rather than
`bevy_reflect::impls::alloc::borrow`.

You may ask: _Isn't this a little overkill? Why does the one-line impl
for `TypeId` need its own file?_

And yes, it is partly overkill. But the benefit with this approach is
that where an `std`-related type should live is mostly unambiguous. If
we wanted to reflect `::core::net::Ipv4Addr`, it's very clear that it
should be done in `bevy_reflect::impls::core::net`.

We can discuss better ways of breaking this up if people have other
ideas or opinions, but I think this is a pretty straightforward way of
doing it.

### Note to Reviewers

The code is pretty much copy-paste from the mega module to the new
submodules. It's probably best to focus efforts on reviewing the general
module structure, as well as maybe which impls are included where.

You _can_ review the code contained within each impl, but I promise you
the only thing I touched were the paths in the macros so they could be
more hygienic :)

## Testing

You can just check that everything compiles still:

```
cargo check -p bevy_reflect --tests
```
2025-05-26 19:10:47 +00:00
..
bevy_a11y Bump accesskit to 0.19 and accesskit_winit to 0.27 (#19160) 2025-05-26 17:48:36 +00:00
bevy_animation Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_anti_aliasing Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_app Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_asset Fix AssetChanged code documentation to mention the PostUpdate schedule (#19093) 2025-05-26 17:34:46 +00:00
bevy_audio Add AudioSinkPlayback::position (#19173) 2025-05-26 17:50:40 +00:00
bevy_color Implemented Alpha for f32. (#18653) 2025-05-06 00:00:17 +00:00
bevy_core_pipeline Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_derive Remove upcasting methods + Cleanup interned label code (#18984) 2025-05-26 15:38:12 +00:00
bevy_dev_tools Improve visibility of debug picking node (#18990) 2025-05-26 15:39:49 +00:00
bevy_diagnostic Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_dylib don't disable std in bevy_dylib (#18807) 2025-04-11 18:44:53 +00:00
bevy_ecs Nonmax all rows (#19132) 2025-05-26 17:39:55 +00:00
bevy_encase_derive Internalize BevyManifest logic. Switch to RwLock (#18263) 2025-03-12 00:46:01 +00:00
bevy_gilrs Remove remaining internal use of !Send resources (#18386) 2025-05-06 22:23:59 +00:00
bevy_gizmos Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_gltf Optional explicit compressed image format support (#19190) 2025-05-26 18:00:33 +00:00
bevy_image Optional explicit compressed image format support (#19190) 2025-05-26 18:00:33 +00:00
bevy_input Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_input_focus Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_internal Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_log feat(log): support customizing default log formatting (#17722) 2025-05-05 23:01:06 +00:00
bevy_macro_utils Better macro errors for get_struct_fields (#17639) 2025-05-26 16:57:03 +00:00
bevy_math Reduce operations in RayCast2d::circle_intersection_at using cross product (#19103) 2025-05-26 17:22:14 +00:00
bevy_mesh Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
bevy_mikktspace fix new nightly lint on mikktspace (#18988) 2025-04-30 05:19:01 +00:00
bevy_pbr Fix spot light shadow glitches (#19273) 2025-05-19 19:42:09 +00:00
bevy_picking don't filter dragged entity out of DragEnter events (#19179) 2025-05-26 17:56:54 +00:00
bevy_platform Create bevy_platform::cfg for viral feature management (#18822) 2025-05-06 00:52:15 +00:00
bevy_ptr moved Debug from derive to impl_ptr in bevy_ptr (#18042) 2025-02-28 02:54:46 +00:00
bevy_reflect bevy_reflect: Split up the std module (#18939) 2025-05-26 19:10:47 +00:00
bevy_remote Fix BRP query failing when specifying missing/invalid components (#18871) 2025-05-26 15:26:46 +00:00
bevy_render Move trigger_screenshots to finish() (#19204) 2025-05-26 18:07:17 +00:00
bevy_scene Make entity generation a new type and remove identifier (#19121) 2025-05-08 04:03:05 +00:00
bevy_sprite Fix Anchor component inconsistancies (#18393) 2025-05-21 15:32:04 +00:00
bevy_state Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_tasks Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
bevy_text Allow access to font atlases (#18851) 2025-05-26 15:22:56 +00:00
bevy_time Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_transform Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_ui Bump accesskit to 0.19 and accesskit_winit to 0.27 (#19160) 2025-05-26 17:48:36 +00:00
bevy_utils Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_window Expose deferred screen edges setting for ios devices (#18729) 2025-04-30 21:24:53 +00:00
bevy_winit Bump accesskit to 0.19 and accesskit_winit to 0.27 (#19160) 2025-05-26 17:48:36 +00:00