diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-03 00:12:09 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-03 00:12:09 +0100 |
| commit | aae67bd572ad86f4c57e364daa51a9dc883b8913 (patch) | |
| tree | 0aba021e0748ebad2197ea390385ec5f93ccbc6e /src/env.rs | |
| parent | 1c40dc42e7bc7b799b77f06d25414aca59a044ba (diff) | |
Move and rename many things 🚛
Diffstat (limited to 'src/env.rs')
| -rw-r--r-- | src/env.rs | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -42,12 +42,13 @@ impl ResourceLoader { Self { paths: HashMap::new(), entries: vec![] } } - /// Load a resource from a path. - pub fn load<R: 'static>( - &mut self, - path: impl AsRef<Path>, - parse: impl FnOnce(Vec<u8>) -> Option<R>, - ) -> Option<(ResourceId, &R)> { + /// Load a resource from a path and parse it. + pub fn load<P, F, R>(&mut self, path: P, parse: F) -> Option<(ResourceId, &R)> + where + P: AsRef<Path>, + F: FnOnce(Vec<u8>) -> Option<R>, + R: 'static, + { let path = path.as_ref(); let id = match self.paths.entry(path.to_owned()) { Entry::Occupied(entry) => *entry.get(), |
