Loader

Trait Loader 

Source
pub trait Loader<T> {
    const EXTENSION: &'static str;

    // Required method
    fn load(bytes: &[u8], id: &Id) -> T;
}
Expand description

How an asset should be loaded.

Required Associated Constants§

Source

const EXTENSION: &'static str

Extension for the file that this loader loads.

Required Methods§

Source

fn load(bytes: &[u8], id: &Id) -> T

Load an asset from raw bytes.

§Arguments
  • bytes - Raw bytes from the file, could be loaded either from disk or from memory.
  • id - ID of the asset to load, mainly used for printing somewhat useful panic messages.
§Panics
  • When anything went wrong with loading the asset.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Loader<(u32, u32, Vec<Rgba<u8>>)> for PngLoader

Source§

const EXTENSION: &'static str = "png"

Source§

impl Loader<StaticSoundData> for OggLoader

Source§

const EXTENSION: &'static str = "ogg"

Source§

impl<T: DeRon> Loader<T> for RonLoader

Source§

const EXTENSION: &'static str = "ron"