assets
pub struct JSONAsset {
data: serde_json::Value,
}
impl Asset for JSONAsset {
type Data = JSONAsset;
}
impl AssetFormat for JSONAsset {
type Input = Vec<u8>;
type Output = JSONAsset;
type Error = serde_json::Error;
type Options = ();
#[inline]
fn format(bytes: Self::Input, _: Self::Options) -> Result<Self::Output, Self::Error> {
let data: serde_json::Value = serde_json::from_slice(&*bytes)?;
Ok(JSONAsset { data: data })
}
}
pub type JSONAssetManager<P> = AssetManager<JSONAsset, FileLoader<P>, CpuPool>;
pub type JSONAssetErrorSystem<P> = AssetErrorSystem<JSONAsset, FileLoader<P>, CpuPool>;