Trait ResourceLoader

Source
pub trait ResourceLoader: Send + Sync {
    // Required methods
    fn name(&self) -> Cow<'_, str>;
    fn try_load(
        &self,
        path: &Path,
        reader: &mut dyn Read,
        framework: &Nnef,
    ) -> Result<Option<(String, Arc<dyn Resource>)>, Error>;

    // Provided method
    fn into_boxed(self) -> Box<dyn ResourceLoader>
       where Self: Sized + 'static { ... }
}

Required Methods§

Source

fn name(&self) -> Cow<'_, str>

Name of the resource loader.

Source

fn try_load( &self, path: &Path, reader: &mut dyn Read, framework: &Nnef, ) -> Result<Option<(String, Arc<dyn Resource>)>, Error>

Try to load a resource give a path and its corresponding reader. None is returned if the path is not accepted by this loader.

Provided Methods§

Source

fn into_boxed(self) -> Box<dyn ResourceLoader>
where Self: Sized + 'static,

Implementors§