-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Create bevy_platform_support
Crate
#17250
Create bevy_platform_support
Crate
#17250
Conversation
Just re-export it as is, the name is fine and this is less surprising. |
Done! |
Marking as blessed due to this comment by @cart. I agree with it too! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand the fallback implementation for Instant
, but the rest looks good to me
Provide instructions more robust to changing version numbers. Co-Authored-By: TimJentzsch <[email protected]>
I should update the documentation to be more clear on how this works. Basically it's a straight copy of the
For the sake of convenience, I've included an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty straightforward and well done!
Why not just call it bevy_platform? It is already reserved on crates.io |
Co-Authored-By: TimJentzsch <[email protected]>
Co-Authored-By: Chris Russell <[email protected]>
It could be called that, but that's a pretty prime crate name that'd have a lot of uses. |
could you add the new crate (in the correct order by depdendency) in https://github.com/bevyengine/bevy/blob/main/tools/publish.sh? |
Co-Authored-By: François Mockers <[email protected]>
Done! |
Once this PR is merged, we should add the crate to cc @cart :) |
Reserved! |
Objective
Solution
bevy_platform_support
crate.bevy_utils::Instant
into newbevy_platform_support
crate.portable-atomic
,portable-atomic-util
, andcritical-section
into newbevy_platform_support
crate.Testing
Showcase
Instead of needing code like this to import an
Arc
:We can now use:
This applies to many other types, but the goal is overall the same: allowing crates to use
std
-like types without the boilerplate of conditional compilation and platform-dependencies.Migration Guide
bevy_utils::Instant
withbevy_platform_support::time::Instant
bevy::utils::Instant
withbevy::platform_support::time::Instant
Notes
bevy_platform_support
hasn't been reserved oncrates.io
bevy_platform_support
is not re-exported frombevy
at this time. It may be worthwhile exporting this crate, but I am unsure of a reasonable name to export it under (platform_support
may be a bit wordy for user-facing).Instant
which is suitable forno_std
platforms that are not Wasm for the sake of eliminating feature gates around its use. It may be a controversial inclusion, so I'm happy to remove it if required.spin
,bevy_utils::Sync(Unsafe)Cell
, etc.) which should be added to this crate. I have kept the initial scope small to demonstrate utility without making this too unwieldy.