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

Add no_std support to bevy_color #16633

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

bushrat011899
Copy link
Contributor

Objective

Solution

  • Added the following new features:
    • std (default)
    • alloc
    • encase (default)
    • libm

Testing

  • Added to compile-check-no-std CI command

Notes

  • ColorCurve requires alloc due to how the underlying EvenCore type works.
  • Srgba::to_hex requires alloc to return a String.
  • This was otherwise a very simple change

@bushrat011899 bushrat011899 added C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy X-Uncontroversial This work is generally agreed upon S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Color Color spaces and color math labels Dec 3, 2024
@IQuick143 IQuick143 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 4, 2024
Copy link
Contributor

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

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

I have to say, I'm a bit surprised that stuff like rounding numbers is not available in core and has to be imported from bevy_math.

But the changes look fine to me :)

@bushrat011899
Copy link
Contributor Author

I have to say, I'm a bit surprised that stuff like rounding numbers is not available in core and has to be imported from bevy_math.

Yeah they were in core in early versions of Rust, but have since been removed. The reason was they depended on libm for their implementation, and they wanted core to be as slim as possible. Since libm is also a no_std library with pretty much perfect platform support it isn't really that big of a change. I'd previously even discussed the idea of adding an extension trait in bevy_math that would make this change entirely transparent. The idea was eventually scrapped, as it's probably a good thing to highlight which maths operations are "problematic".

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 5, 2024
Merged via the queue into bevyengine:main with commit 73c6479 Dec 5, 2024
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Color Color spaces and color math C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants