Trait amethyst_assets::Source [−][src]
pub trait Source: Send + Sync + 'static { fn modified(&self, path: &str) -> Result<u64>; fn load(&self, path: &str) -> Result<Vec<u8>>; fn load_with_metadata(&self, path: &str) -> Result<(Vec<u8>, u64)> { ... } }
A trait for asset sources, which provides methods for loading bytes.
Required Methods
fn modified(&self, path: &str) -> Result<u64>
This is called to check if an asset has been modified.
Returns the modification time as seconds since UNIX_EPOCH
.
fn load(&self, path: &str) -> Result<Vec<u8>>
Loads the bytes given a path.
The id should always use /
as separator in paths.
Provided Methods
fn load_with_metadata(&self, path: &str) -> Result<(Vec<u8>, u64)>
Returns both the result of load
and modified
as a tuple.
There's a default implementation which just calls both methods,
but you may be able to provide a more optimized version yourself.
Implementors
impl Source for Directory