1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use amethyst_error::Error;
pub use self::dir::Directory;
#[cfg(feature = "profiler")]
use thread_profiler::profile_scope;
mod dir;
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> {
#[cfg(feature = "profiler")]
profile_scope!("source_load_asset_with_metadata");
let m = self.modified(path)?;
let b = self.load(path)?;
Ok((b, m))
}
}