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] - Move float_ord from bevy_core to bevy_utils #4189

Closed
wants to merge 1 commit into from

Conversation

CAD97
Copy link
Contributor

@CAD97 CAD97 commented Mar 12, 2022

Objective

Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils.

A step in addressing #2931 and splitting bevy_core into more specific locations.

Solution

Move FloatOrd into bevy_utils. Fix the compile errors.

As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for FloatOrd previously).

Migration guide

Replace imports of bevy::core::FloatOrd with bevy::utils::FloatOrd.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Mar 12, 2022
@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change A-Core A-Utils Utility functions and types and removed S-Needs-Triage This issue needs to be labelled labels Mar 12, 2022
@@ -41,12 +41,12 @@ impl Hash for FloatOrd {
fn hash<H: Hasher>(&self, state: &mut H) {
if self.0.is_nan() {
// Ensure all NaN representations hash to the same value
state.write(bytemuck::bytes_of(&f32::NAN));
state.write(&f32::to_ne_bytes(f32::NAN));
Copy link
Member

Choose a reason for hiding this comment

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

What's up with this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bevy_utils doesn't use bytemuck (currently, at least), so rather than add a bytemuck dep I just wrote the equivalent code with std support.

If it's preferred, we could just add bytemuck to bevy_utils, but it is in fact equivalent either way.

(It might be plausible that the bytemuck reëxport moves from bevy_core to bevy_utils as well, but I'm unsure about that one and just wanted to move FloatOrd here.)

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me; I'm content not to pull in the dependency here.

@alice-i-cecile
Copy link
Member

One quick question. I like this change though; it's clearly the right organization and the rest lgtm.

@james7132 james7132 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 13, 2022
@james7132
Copy link
Member

bors try

bors bot added a commit that referenced this pull request Mar 13, 2022
@alice-i-cecile
Copy link
Member

@CAD97 can you rebase?

@CAD97
Copy link
Contributor Author

CAD97 commented Apr 27, 2022

Rebased.

@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Apr 27, 2022
# Objective

Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils.

A step in addressing #2931 and splitting bevy_core into more specific locations.

## Solution

Move FloatOrd into bevy_utils. Fix the compile errors.

As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
@bors bors bot changed the title Move float_ord from bevy_core to bevy_utils [Merged by Bors] - Move float_ord from bevy_core to bevy_utils Apr 27, 2022
@bors bors bot closed this Apr 27, 2022
@CAD97 CAD97 deleted the float_ord branch April 27, 2022 18:42
@Nilirad
Copy link
Contributor

Nilirad commented Apr 28, 2022

This should be labeled as a breaking change: those who import single items from Bevy instead of the prelude will have their builds broken.

@mockersf mockersf added the M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Apr 28, 2022
@alice-i-cecile
Copy link
Member

@CAD97 can you add a quick migration guide to this?

exjam pushed a commit to exjam/bevy that referenced this pull request May 22, 2022
# Objective

Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils.

A step in addressing bevyengine#2931 and splitting bevy_core into more specific locations.

## Solution

Move FloatOrd into bevy_utils. Fix the compile errors.

As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

Reduce the catch-all grab-bag of functionality in bevy_core by moving FloatOrd to bevy_utils.

A step in addressing bevyengine#2931 and splitting bevy_core into more specific locations.

## Solution

Move FloatOrd into bevy_utils. Fix the compile errors.

As a result, bevy_core_pipeline, bevy_pbr, bevy_sprite, bevy_text, and bevy_ui no longer depend on bevy_core (they were only using it for `FloatOrd` previously).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Utils Utility functions and types C-Code-Quality A section of code that is hard to understand or change M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants