pub trait Format<A: Asset>: Send + 'static {
    type Options: Send + 'static;

    const NAME: &'static str;

    fn import(
        &self,
        name: String,
        source: Arc<dyn Source>,
        options: Self::Options,
        create_reload: bool
    ) -> Result<FormatValue<A>>; }
Expand description

A format, providing a conversion from bytes to asset data, which is then in turn accepted by Asset::from_data. Examples for formats are Png, Obj and Wave.

Required Associated Types

Options specific to the format, which are passed to import. E.g. for textures this would be stuff like mipmap levels and sampler info.

Required Associated Constants

A unique identifier for this format.

Required Methods

Reads the given bytes and produces asset data.

Reload

The reload structure has metadata which allows the asset management to reload assets if necessary (for hot reloading). You should only create this if create_reload is true. Also, the parameter is just a request, which means you can also return None.

Implementors