Skip to content

Commit

Permalink
fix fn signatures on asset loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-reinhart committed Jul 4, 2024
1 parent 2a97ae2 commit f5a8a47
Showing 1 changed file with 30 additions and 37 deletions.
67 changes: 30 additions & 37 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use bevy::{
asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext},
prelude::*,
reflect::TypePath,
utils::BoxedFuture,
};
use rusty_spine::SpineError;
use thiserror::Error;
Expand Down Expand Up @@ -33,24 +32,22 @@ impl AssetLoader for AtlasLoader {
type Settings = ();
type Error = SpineLoaderError;

fn load<'a>(
async fn load<'a>(
&'a self,
reader: &'a mut Reader,
reader: &'a mut Reader<'_>,
_settings: &'a Self::Settings,
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?;
Ok(Atlas {
atlas: Arc::new(rusty_spine::Atlas::new(
&bytes,
load_context
.path()
.parent()
.unwrap_or_else(|| Path::new("")),
)?),
})
load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
let mut bytes = Vec::new();
reader.read_to_end(&mut bytes).await?;
Ok(Atlas {
atlas: Arc::new(rusty_spine::Atlas::new(
&bytes,
load_context
.path()
.parent()
.unwrap_or_else(|| Path::new("")),
)?),
})
}

Expand All @@ -75,18 +72,16 @@ impl AssetLoader for SkeletonJsonLoader {
type Settings = ();
type Error = SpineLoaderError;

fn load<'a>(
async fn load<'a>(
&'a self,
reader: &'a mut Reader,
reader: &'a mut Reader<'_>,
_settings: &'a Self::Settings,
_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?;
Ok(SkeletonJson {
json: bytes.to_vec(),
})
_load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
let mut bytes = Vec::new();
reader.read_to_end(&mut bytes).await?;
Ok(SkeletonJson {
json: bytes.to_vec(),
})
}

Expand All @@ -111,18 +106,16 @@ impl AssetLoader for SkeletonBinaryLoader {
type Settings = ();
type Error = SpineLoaderError;

fn load<'a>(
async fn load<'a>(
&'a self,
reader: &'a mut Reader,
reader: &'a mut Reader<'_>,
_settings: &'a Self::Settings,
_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?;
Ok(SkeletonBinary {
binary: bytes.to_vec(),
})
_load_context: &'a mut LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
let mut bytes = Vec::new();
reader.read_to_end(&mut bytes).await?;
Ok(SkeletonBinary {
binary: bytes.to_vec(),
})
}

Expand Down

0 comments on commit f5a8a47

Please sign in to comment.