Skip to main content

AssetType

Trait AssetType 

Source
pub trait AssetType: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn loader(&self) -> Box<dyn AssetDataLoader>;
    fn saver(&self) -> Box<dyn AssetDataSaver>;
}
Expand description

Defines how a specific type of asset should be loaded and saved.

Asset types provide the metadata and behavior for handling different kinds of assets. Each asset type has a unique name and provides factories for creating loaders and savers.

Required Methods§

Source

fn name(&self) -> &str

Returns the unique name identifier for this asset type.

Source

fn loader(&self) -> Box<dyn AssetDataLoader>

Creates a new loader instance for this asset type.

The loader is responsible for converting raw bytes into asset data.

Source

fn saver(&self) -> Box<dyn AssetDataSaver>

Creates a new saver instance for this asset type.

The saver is responsible for converting asset data back to raw bytes.

Implementors§