Give entity_ref
its own folder and split into multiple files
#21605
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
world/entity_ref.rs
is the biggest single source file in Bevy at ~6800 lines. It can be a bit hard to navigate.Solution
Rename the
entity_ref
module toentity_access
and split it into 8 files:mod.rs
: Re-exports and testing, ~1600 linesentity_ref.rs
:EntityRef
type, ~340 linesentity_mut.rs
:EntityMut
type, ~760 linesworld_mut.rs
:EntityWorldMut
type, ~2200 linesfiltered.rs
:FilteredEntityRef
andFilteredEntityMut
types, ~780 linesexcept.rs
:EntityRefExcept
andEntityMutExcept
types, ~500 linesentry.rs
:ComponentEntry
type, ~330 linescomponent_fetch.rs
:DynamicComponentFetch
trait, ~360 linesworld_mut
is still sizable, but that's just the sheer number of methodsEntityWorldMut
has. Splitting the methods across multiple files is possible, but that might be more annoying than a large file.