bevy/crates
Alice Cecile 44ad3bf62b
Move Resource trait to its own file (#17469)
# Objective

`bevy_ecs`'s `system` module is something of a grab bag, and *very*
large. This is particularly true for the `system_param` module, which is
more than 2k lines long!

While it could be defensible to put `Res` and `ResMut` there (lol no
they're in change_detection.rs, obviously), it doesn't make any sense to
put the `Resource` trait there. This is confusing to navigate (and
painful to work on and review).

## Solution

- Create a root level `bevy_ecs/resource.rs` module to mirror
`bevy_ecs/component.rs`
- move the `Resource` trait to that module
- move the `Resource` derive macro to that module as well (Rust really
likes when you pun on the names of the derive macro and trait and put
them in the same path)
- fix all of the imports

## Notes to reviewers

- We could probably move more stuff into here, but I wanted to keep this
PR as small as possible given the absurd level of import changes.
- This PR is ground work for my upcoming attempts to store resource data
on components (resources-as-entities). Splitting this code out will make
the work and review a bit easier, and is the sort of overdue refactor
that's good to do as part of more meaningful work.

## Testing

cargo build works!

## Migration Guide

`bevy_ecs::system::Resource` has been moved to
`bevy_ecs::resource::Resource`.
2025-01-21 19:47:08 +00:00
..
bevy_a11y Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_animation Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_app Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_asset Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_audio Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_color Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_core_pipeline Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dev_tools Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_diagnostic Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_dylib Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_ecs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_encase_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gilrs Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
bevy_gizmos Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_gltf Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_image Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_input Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_input_focus Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_internal Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_log Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_macro_utils Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_math Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
bevy_mesh Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_mikktspace Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_pbr Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_picking Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_platform_support Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_ptr Update safety docs for Ptr::assert_unique (#17394) 2025-01-16 03:25:19 +00:00
bevy_reflect Include ReflectFromReflect in all dynamic data types. (#17453) 2025-01-20 22:08:24 +00:00
bevy_remote Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_render Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_scene Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_sprite Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_state Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_tasks Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_text Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_time Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_transform Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_ui Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_utils Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_window Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_winit Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00