[][src]Trait amethyst_assets::Source

pub trait Source: Send + Sync + 'static {
    fn modified(&self, path: &str) -> Result<u64, Error>;
fn load(&self, path: &str) -> Result<Vec<u8>, Error>; fn load_with_metadata(&self, path: &str) -> Result<(Vec<u8>, u64), Error> { ... } }

A trait for asset sources, which provides methods for loading bytes.

Required methods

fn modified(&self, path: &str) -> Result<u64, Error>

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>, Error>

Loads the bytes given a path.

The id should always use / as separator in paths.

Loading content...

Provided methods

fn load_with_metadata(&self, path: &str) -> Result<(Vec<u8>, u64), Error>

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.

Loading content...

Implementors

impl Source for Directory[src]

Loading content...