[−][src]Trait amethyst_assets::FormatRegisteredData
A trait for all asset types that have their format types.
Use this as a bound for asset data types when used inside boxed format types intended for deserialization.
registered with register_format_type
macro.
This trait should never be implemented manually. Use the register_format_type
macro to register it correctly.
ⓘThis example is not tested
// this must be used exactly once per data type amethyst_assets::register_format_type!(AudioData); // this must be used for every Format type impl that can be deserialized dynamically amethyst_assets::register_format!("WAV", AudioData as WavFormat); impl Format<AudioData> for WavFormat { fn name(&self) -> &'static str { "WAV" } fn import_simple(&self, bytes: Vec<u8>) -> Result<AudioData, Error> { Ok(AudioData(bytes)) } } impl SerializableFormat<AudioData> for WavFormat {}