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

Move futures.rs, ConditionalSend and BoxedFuture types to bevy_tasks #16951

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mnmaita
Copy link
Member

@mnmaita mnmaita commented Dec 24, 2024

Objective

Solution

  • Moved futures.rs, ConditionalSend ConditionalSendFuture and BoxedFuture from bevy_utils to bevy_tasks.

Testing

  • CI checks

Migration Guide

  • Several modules were moved from bevy_utils into bevy_tasks:
    • Replace bevy_utils::futures imports with bevy_tasks::futures.
    • Replace bevy_utils::ConditionalSend with bevy_tasks::ConditionalSend.
    • Replace bevy_utils::ConditionalSendFuture with bevy_tasks::ConditionalSendFuture.
    • Replace bevy_utils::BoxedFuture with bevy_tasks::BoxedFuture.

@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Dec 24, 2024
@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change A-Tasks Tools for parallel and async work S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers labels Dec 24, 2024
@mnmaita
Copy link
Member Author

mnmaita commented Dec 24, 2024

Wondering if the added alloc feature is the proper way to do it or if there's a different way.

@mnmaita mnmaita marked this pull request as ready for review December 24, 2024 19:01
Copy link
Contributor

@bushrat011899 bushrat011899 left a comment

Choose a reason for hiding this comment

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

Totally agree with this change, just need to remove the alloc feature from bevy_tasks since we can safely assume access to an allocator.

@@ -10,7 +10,9 @@ keywords = ["bevy"]

[features]
default = ["std", "async_executor"]
alloc = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Within bevy_tasks, alloc is mandatory, so this feature isn't required.

pub trait ConditionalSendFuture: core::future::Future + ConditionalSend {}
impl<T: core::future::Future + ConditionalSend> ConditionalSendFuture for T {}

#[cfg(feature = "alloc")]
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be sufficient to just remove these cfg(...) attributes in order to remove the alloc feature. This will also need to be done in futures.rs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for chiming in on this one, I was unsure what to do with it.

Removed the feature and the cfgs. There were no instances of this in futures.rs FWIW.

@mnmaita mnmaita added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Dec 26, 2024
@BenjaminBrienen BenjaminBrienen 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 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tasks Tools for parallel and async work C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants