pub trait LoadableResource: Any {
// Required methods
fn load(
path: PathBuf,
texture_creator: &Arc<TextureCreator<WindowContext>>,
) -> Result<Box<dyn LoadableResource>>
where Self: Sized;
fn name(&self) -> String;
fn as_mut_slice(&self) -> &mut [u8] ⓘ;
fn as_slice(&self) -> Ref<'_, [u8]>;
}Expand description
Trait that all loadable assets must implement
Required Methods§
Sourcefn load(
path: PathBuf,
texture_creator: &Arc<TextureCreator<WindowContext>>,
) -> Result<Box<dyn LoadableResource>>where
Self: Sized,
fn load(
path: PathBuf,
texture_creator: &Arc<TextureCreator<WindowContext>>,
) -> Result<Box<dyn LoadableResource>>where
Self: Sized,
Load a resource from path and return it boxed
§Errors
Returns an error if the file cannot be read or parsed
Sourcefn as_mut_slice(&self) -> &mut [u8] ⓘ
fn as_mut_slice(&self) -> &mut [u8] ⓘ
Return a mutable slice that the graphics thread can pass to SDL