From 8dea3ccd895d7c82c711cc915fa20adaf37b0f20 Mon Sep 17 00:00:00 2001 From: Jan Hohenheim Date: Sun, 23 Jun 2024 12:23:40 +0200 Subject: [PATCH] Port asset loader to Bevy 0.14 --- crates/bevy_plugin/src/yarn_file_asset.rs | 23 +++++++++-------------- rust-toolchain.toml | 2 -- 2 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/crates/bevy_plugin/src/yarn_file_asset.rs b/crates/bevy_plugin/src/yarn_file_asset.rs index 140b7bd5..35a2d7a2 100644 --- a/crates/bevy_plugin/src/yarn_file_asset.rs +++ b/crates/bevy_plugin/src/yarn_file_asset.rs @@ -2,10 +2,7 @@ use crate::prelude::*; use bevy::asset::{io::Reader, AsyncReadExt}; use bevy::prelude::*; -use bevy::{ - asset::{AssetLoader, LoadContext}, - utils::BoxedFuture, -}; +use bevy::asset::{AssetLoader, LoadContext}; use std::hash::Hash; use yarnspinner::prelude::YarnFile as InnerYarnFile; @@ -80,18 +77,16 @@ impl AssetLoader for YarnFileAssetLoader { type Asset = YarnFile; type Settings = (); type Error = anyhow::Error; - fn load<'a>( + async fn load<'a>( &'a self, - reader: &'a mut Reader, + reader: &'a mut Reader<'_>, _settings: &'a (), - load_context: &'a mut LoadContext, - ) -> BoxedFuture<'a, Result> { - Box::pin(async move { - let mut bytes = Vec::new(); - reader.read_to_end(&mut bytes).await?; - let yarn_file = read_yarn_file(bytes, load_context)?; - Ok(yarn_file) - }) + load_context: &'a mut LoadContext<'_>, + ) -> Result { + let mut bytes = Vec::new(); + reader.read_to_end(&mut bytes).await?; + let yarn_file = read_yarn_file(bytes, load_context)?; + Ok(yarn_file) } fn extensions(&self) -> &[&str] { diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 292fe499..00000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "stable"