pub trait LoadableResource: Any {
// Required methods
fn load(
path: PathBuf,
graphics: &mut Graphics,
size: Option<f32>,
) -> Result<Box<dyn LoadableResource>>
where Self: Sized;
fn name(&self) -> String;
// Provided methods
fn as_mut_slice(&self) -> Option<&mut [u8]> { ... }
fn as_slice(&self) -> Option<Ref<'_, [u8]>> { ... }
}Expand description
Trait that all loadable assets must implement
Required Methods§
Provided Methods§
Sourcefn as_mut_slice(&self) -> Option<&mut [u8]>
fn as_mut_slice(&self) -> Option<&mut [u8]>
Return a mutable slice that the graphics thread can pass to SDL
If the resource does not have a buffer, then it mustn’t implement this function