pub trait ResourceLoader: ResourceLoaderTypeTrait {
    // Required methods
    fn extensions(&self) -> &[&str];
    fn data_type_uuid(&self) -> Uuid;
    fn load(&self, path: PathBuf, io: Arc<dyn ResourceIo>) -> BoxedLoaderFuture;

    // Provided methods
    fn supports_extension(&self, ext: &str) -> bool { ... }
    fn try_load_import_settings(
        &self,
        resource_path: PathBuf,
        io: Arc<dyn ResourceIo>
    ) -> BoxedImportOptionsLoaderFuture { ... }
    fn default_import_options(&self) -> Option<Box<dyn BaseImportOptions>> { ... }
}
Expand description

Trait for resource loading.

Required Methods§

source

fn extensions(&self) -> &[&str]

Returns a list of file extensions supported by the loader. Resource manager will use this list to pick the correct resource loader when the user requests a resource.

source

fn data_type_uuid(&self) -> Uuid

Must return a type uuid of the resource data type.

source

fn load(&self, path: PathBuf, io: Arc<dyn ResourceIo>) -> BoxedLoaderFuture

Loads or reloads a resource.

Provided Methods§

source

fn supports_extension(&self, ext: &str) -> bool

Checks if the given extension is supported by this loader. Comparison is case-insensitive.

source

fn try_load_import_settings( &self, resource_path: PathBuf, io: Arc<dyn ResourceIo> ) -> BoxedImportOptionsLoaderFuture

Tries to load import settings for a resource.

source

fn default_import_options(&self) -> Option<Box<dyn BaseImportOptions>>

Returns default import options for the resource.

Implementors§