Trait include_assets_decode::enums::AssetEnum
source · 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§
Required Associated Constants§
sourceconst DATA_END_OFFSETS: &'static [u32]
const DATA_END_OFFSETS: &'static [u32]
Position of the end of the asset data for each enum within the uncompressed combined data.
Required Methods§
sourcefn index(self) -> usize
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§
sourcefn load() -> EnumArchive<Self>
fn load() -> EnumArchive<Self>
Load (decompress) compressed data for this enum.