Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Remove Bytes, FromBytes, Labels, EntityLabels. Document rest of bevy_core and enable warning on missing docs. #3521

Closed
wants to merge 5 commits into from

Conversation

james7132
Copy link
Member

This PR is part of the issue #3492.

Objective

  • Clean up dead code in bevy_core.
  • Add and update the bevy_core documentation to achieve a 100% documentation coverage.
  • Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future.

Solution

  • Remove unused Bytes, FromBytes, Labels, and EntityLabels types and associated systems.
  • Made several types private that really only have use as internal types, mostly pertaining to fixed timestep execution.
  • Add and update the bevy_core documentation.
  • Add the #![warn(missing_docs)] lint.

Open Questions

Should more of the internal states of FixedTimestep be public? Seems mostly to be an implementation detail unless someone really needs that fixed timestep state.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Jan 2, 2022
@alice-i-cecile alice-i-cecile added A-Core C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation and removed S-Needs-Triage This issue needs to be labelled labels Jan 2, 2022
@alice-i-cecile
Copy link
Member

Should more of the internal states of FixedTimestep be public? Seems mostly to be an implementation detail unless someone really needs that fixed timestep state.

I'll defer to @maniwani (Joy) here; they've thought most deeply about this.

@james7132
Copy link
Member Author

Does this PR require a migration guide? Not sure how many users were dependent on those public types, including the ones made private.

@alice-i-cecile
Copy link
Member

Does this PR require a migration guide? Not sure how many users were dependent on those public types, including the ones made private.

Yep, we'll toss it in the tag. It's not critical, but it is nice to have some indication that we made breaking changes.

@alice-i-cecile
Copy link
Member

Looks great; only a couple things to expand on.

@james7132
Copy link
Member Author

james7132 commented Jan 2, 2022

Migration Guide for this PR:

Bytes/FromBytes removed

The traits Bytes and FromBytes have been removed. These types were largely used for converting types to byte buffers for loading into rendering pipelines and some forms of serialization. With the render rework, bevy_crevice has largely taken over for the role of converting types to rendering friendly byte buffers.

For serialization, both traits did not strictly define a binary representation or serialization format, and only allowed one representation per type. For these use cases, it's suggested to either use serde and a binary serialization format (i.e. bincode).

For conversion of plain-old-data (POD) types to their byte slice representation, it's suggested to directly use bytemuck's functions instead to reinterpret said data.

Labels/EntityLabels removed.

The component Labels and resource EntityLabels have been removed. These were largely used to label entities with string labels, and find all entities with a given label. These were added mostly in preparation for use in a editor.

It is suggested to instead use ZST (zero-size type) marker components, and add them to entities instead. This does not require runtime string hashing, and can be efficiently queried via queries as system parameters.

FixedTimestepState fields made private.

The inner fields of FixedTimestepState were erroneously made public when they shouldn't have been.

@alice-i-cecile
Copy link
Member

You should also note that some of the state for FixedTimeStep was made private.

Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be sad to see Labels go away, but it's the right thing to do 👍

@cart
Copy link
Member

cart commented Jan 2, 2022

bors r+

bors bot pushed a commit that referenced this pull request Jan 2, 2022
…core and enable warning on missing docs. (#3521)

This PR is part of the issue #3492.

# Objective

 - Clean up dead code in `bevy_core`.
 - Add and update the `bevy_core` documentation to achieve a 100% documentation coverage.
 - Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future.

# Solution

 - Remove unused `Bytes`, `FromBytes`, `Labels`, and `EntityLabels` types and associated systems.
 - Made several types private that really only have use as internal types, mostly pertaining to fixed timestep execution.
 - Add and update the bevy_core documentation.
 - Add the #![warn(missing_docs)] lint.

# Open Questions

Should more of the internal states of `FixedTimestep` be public? Seems mostly to be an implementation detail unless someone really needs that fixed timestep state.
@james7132
Copy link
Member Author

You should also note that some of the state for FixedTimeStep was made private.

Only LocalFixedTimestepState was privated and that doesn't look to be available in 0.5, looks like it was introduced after the fact. Added a note about the field of FixedTimestepState being privated, since those shouldn't be mutable outside of the crate.

@bors bors bot changed the title Remove Bytes, FromBytes, Labels, EntityLabels. Document rest of bevy_core and enable warning on missing docs. [Merged by Bors] - Remove Bytes, FromBytes, Labels, EntityLabels. Document rest of bevy_core and enable warning on missing docs. Jan 2, 2022
@bors bors bot closed this Jan 2, 2022
@james7132 james7132 deleted the docs-core branch January 2, 2022 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants