-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Use async fn in trait instead of BoxedFuture #11308
Copy link
Copy link
Closed
Labels
A-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsC-FeatureA new feature, making something new possibleA new feature, making something new possible
Metadata
Metadata
Assignees
Labels
A-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsC-FeatureA new feature, making something new possibleA new feature, making something new possible
Type
Fields
Give feedbackNo fields configured for issues without a type.
What problem does this solve or what need does it fill?
async fnand return-positionimpl Traitin trait as been stabilized in1.75(rust-lang/rust#115822)What solution would you like?
Replace usage of
BoxedFuturein traits likeAssetLoaderbyasync fn.bevy/crates/bevy_asset/src/loader.rs
Lines 33 to 38 in ce5bae5
What alternative(s) have you considered?
Keep using
BoxedFuturewithBox::pin(async move { /* */ });.Current limitations
Because of the send bound problem, there is no way, yet, to add the
Sendbound on the returned future.Alternatively it's possible to use
impl Future + Send: