Skip to content

Commit

Permalink
Port asset loader to Bevy 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Jun 23, 2024
1 parent be34da7 commit 8dea3cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
23 changes: 9 additions & 14 deletions crates/bevy_plugin/src/yarn_file_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<Self::Asset, Self::Error>> {
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<Self::Asset, Self::Error> {
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] {
Expand Down
2 changes: 0 additions & 2 deletions rust-toolchain.toml

This file was deleted.

0 comments on commit 8dea3cc

Please sign in to comment.