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)> { ... }
}
Expand description

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

Required Methods

This is called to check if an asset has been modified.

Returns the modification time as seconds since UNIX_EPOCH.

Loads the bytes given a path.

The id should always use / as separator in paths.

Provided Methods

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