What problem does this solve or what need does it fill?
async fn and return-position impl Trait in trait as been stabilized in 1.75 (rust-lang/rust#115822)
What solution would you like?
Replace usage of BoxedFuture in traits like AssetLoader by async fn.
|
fn load<'a>( |
|
&'a self, |
|
reader: &'a mut Reader, |
|
settings: &'a Self::Settings, |
|
load_context: &'a mut LoadContext, |
|
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>>; |
async fn load<'a>(
&'a self,
reader: &'a mut Reader,
settings: &'a Self::Settings,
load_context: &'a mut LoadContext,
) -> Result<Self::Asset, Self::Error>;
What alternative(s) have you considered?
Keep using BoxedFuture with Box::pin(async move { /* */ });.
Current limitations
Because of the send bound problem, there is no way, yet, to add the Send bound on the returned future.
Alternatively it's possible to use impl Future + Send:
fn load<'a>(
&'a self,
reader: &'a mut Reader,
settings: &'a Self::Settings,
load_context: &'a mut LoadContext,
) -> impl Future<Output = Result<Self::Asset, Self::Error>> + Send + 'a;
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: