#[cfg(not(target_arch = "wasm32"))]
#[path = "platform/native.rs"]
mod native;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) use native::AssetState;
#[cfg(target_arch = "wasm32")]
#[path = "platform/wasm.rs"]
mod wasm;
#[cfg(target_arch = "wasm32")]
pub(crate) use wasm::AssetState;
mod asset;
mod error;
pub use self::asset::Asset;
pub use self::error::LoaderError;
pub(crate) use self::asset::AssetRequest;
use crate::{App, Context};
pub(crate) trait AssetStateContract<A: App> {
fn init() -> Self;
fn read(&mut self, request: AssetRequest<A>);
fn next(&mut self) -> Option<AssetRequest<A>>;
}
impl<A: App> Context<A> {
pub fn read<C: FnMut(&mut Context<A>, &mut A, alloc::vec::Vec<Asset>) + 'static>(
&mut self,
relative_paths: &[impl AsRef<str>],
callback: C,
) {
let request = AssetRequest::new(relative_paths, callback);
self.assets().read(request);
}
}