Skip to main content

AssetDecoder

Trait AssetDecoder 

Source
pub trait AssetDecoder<A: Asset> {
    // Required method
    fn load(&self, bytes: &[u8]) -> Result<A, Box<dyn Error + Send + Sync>>;
}
Expand description

A trait for types that can decode a specific kind of asset from raw bytes.

Each implementation handles one asset type (e.g., CpuTexture, Mesh, SoundData). Concrete decoders live in khora-lanes (they also implement Lane for identity).

Required Methods§

Source

fn load(&self, bytes: &[u8]) -> Result<A, Box<dyn Error + Send + Sync>>

Parses a byte slice and converts it into an instance of the asset A.

Implementors§