pub trait AssetEnum: Sized {
    type C: Codec;

    const DATA: &'static [u8];
    const DATA_END_OFFSETS: &'static [u32];
    const CHECKSUMS: &'static [Checksum];
    const CODEC: Self::C;

    // Required method
    fn index(self) -> usize;

    // Provided method
    fn load() -> EnumArchive<Self> { ... }
}
Expand description

Trait for assets that can be lookup up by enum.

This should never be implemented manually, only derived.

Required Associated Types§

source

type C: Codec

Type of compression codec

Required Associated Constants§

source

const DATA: &'static [u8]

Compressed asset data

source

const DATA_END_OFFSETS: &'static [u32]

Position of the end of the asset data for each enum within the uncompressed combined data.

source

const CHECKSUMS: &'static [Checksum]

Checksums for all assets

source

const CODEC: Self::C

Compression codec with which to decompress the asset data

Required Methods§

source

fn index(self) -> usize

This method should map an enum variant to its discriminator (via as casting).

The reason this exists is that the Index implementation for EnumArchive cannot perform this cast (because it doesn’t know that implementers are enums)

Provided Methods§

source

fn load() -> EnumArchive<Self>

Load (decompress) compressed data for this enum.

Implementors§