pub trait Asset:
Sized
+ Send
+ Sync
+ 'static {
const KIND: &'static str;
// Required method
fn decode(bytes: &[u8], context: &LoadContext) -> Result<Self>;
// Provided method
fn retained_bytes(&self) -> usize { ... }
}Expand description
A custom typed resource decoded once for a shared source and project context.
Required Associated Constants§
Required Methods§
Sourcefn decode(bytes: &[u8], context: &LoadContext) -> Result<Self>
fn decode(bytes: &[u8], context: &LoadContext) -> Result<Self>
Decodes bounded input without requiring a rendering device. Implementations must be deterministic for these bytes/context; recursive resource dependency graphs are not a supported decoder contract.
Provided Methods§
Sourcefn retained_bytes(&self) -> usize
fn retained_bytes(&self) -> usize
Logical decoded payload charge; custom heap-owning assets should override. At least the encoded input length is charged regardless of this value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".