bevy/crates/bevy_app/src
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
..
app.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
lib.rs Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
main_schedule.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
panic_handler.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
plugin_group.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
plugin.rs Update downcast-rs to version 2 (#17223) 2025-01-07 21:33:40 +00:00
schedule_runner.rs Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
sub_app.rs Update downcast-rs to version 2 (#17223) 2025-01-07 21:33:40 +00:00
task_pool_plugin.rs Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
terminal_ctrl_c_handler.rs Add no_std support to bevy_app (#16874) 2024-12-18 22:04:45 +00:00