pub fn load<T>(&self, path: impl AsRef<Path>) -> Result<Arc<T>, AssetLoadError>
    where
        T: 'static + Debug + Any + Send + Sync,
    {
        match self.types.get(&TypeId::of::<T>()) {
            Some((cache, loader)) => {
                let cache = cache.downcast_ref::<AssetCacheManager<T>>().unwrap();

                match cache.load(&path) {
                    Some(asset) => Ok(asset),
                    None => {
                        let asset = loader.downcast_ref::<AssetLoader<T>>().unwrap().load(
                            self,
                            self.base.as_path(),
                            path.as_ref(),
                        )?;

                        cache.cache(path.as_ref().to_path_buf(), Arc::downgrade(&asset));
                        Ok(asset)
                    }
                }
            }
            None => Err(AssetLoadError::unsupported::<T>()),
        }
    }
// TODO: Provide async-way to load assets.
Provide async-way to load assets.
Provide async - way to load assets .
pub fn load<T>(&self, path: impl AsRef<Path>) -> Result<Arc<T>, AssetLoadError>
    where
        T: 'static + Debug + Any + Send + Sync,
    {
        match self.types.get(&TypeId::of::<T>()) {
            Some((cache, loader)) => {
                let cache = cache.downcast_ref::<AssetCacheManager<T>>().unwrap();
                match cache.load(&path) {
                    Some(asset) => Ok(asset),
                    None => {
                        let asset = loader.downcast_ref::<AssetLoader<T>>().unwrap().load(
                            self,
                            self.base.as_path(),
                            path.as_ref(),
                        )?;
                        cache.cache(path.as_ref().to_path_buf(), Arc::downgrade(&asset));
                        Ok(asset)
                    }
                }
            }
            None => Err(AssetLoadError::unsupported::<T>()),
        }
    }
pub fn load < T > ( & self , path : impl AsRef < Path > ) -> Result < Arc < T > , AssetLoadError > where T : ' static + Debug + Any + Send + Sync , { match self . types . get ( & TypeId :: of :: < T > ( ) ) { Some ( ( cache , loader ) ) => { let cache = cache . downcast_ref :: < AssetCacheManager < T > > ( ) . unwrap ( ) ; match cache . load ( & path ) { Some ( asset ) => Ok ( asset ) , None => { let asset = loader . downcast_ref :: < AssetLoader < T > > ( ) . unwrap ( ) . load ( self , self . base . as_path ( ) , path . as_ref ( ) , ) ? ; cache . cache ( path . as_ref ( ) . to_path_buf ( ) , Arc :: downgrade ( & asset ) ) ; Ok ( asset ) } } } None => Err ( AssetLoadError :: unsupported :: < T > ( ) ) , } }
TODO: Provide async-way to load assets.
TODO : Provide async - way to load assets .
&self
path
impl AsRef<Path>