Description
Many internal implementation details are exposed to end users of bevy_ecs
.
Most of these are very complex, largely undocumented and risky to mess with. Where possible, these should be pub(crate)
instead.
Doing this makes our docs more browseable, and clearly communicates to Bevy developers which parts of the infrastructure are public API, worthy of special attention. In the extremely distant future, this would also allow us to make breaking changes to these types and methods without a major version bump.
Initial List of "Why is this pub
"
- All of the types and methods in
bevy::ecs::archetype
, except maybeArchetypes
itself BundleId
,BundleInfo
andBundles
ComponentId
,ComponentInfo
andComponentDescriptor
EntityLocation
andEntityMeta
- all of
bevy::ecs::storage
This is a reasonably aggressive list: if you can find an argument for why a type should be pub, we can leave it pub.
If another crate (bevy_scenes and bevy_reflect are the most likely candidates) relies heavily on a set of otherwise obscure functionality, we should discuss code organization.
If we could eventually use something being pub, we should probably make it private for now, and then revert that once a tangible use case arises, with a sensible API to meet those needs.
This list is also not exhaustive. I'm sure there will also be a number of methods and so on lurking that I've overlooked.
Follow-up
- The public facing API for bevy_ecs::component needs a once-over. Probably just enough to work with for scripting/reflection, but there are some rather redundant types exposed there (ComponentInfo vs ComponentDescriptor is especially confusing)
- Schedule definitely needs a scan through. A lot of these are probably going to be massively rewritten during stageless, but a more coherent docs story there is needed.
- Reflect and EntityMap types need to be shuffled around to be a bit more coherent.
From @james7132 in #5065.