summaryrefslogtreecommitdiff
path: root/src/env.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-03 00:12:09 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-03 00:12:09 +0100
commitaae67bd572ad86f4c57e364daa51a9dc883b8913 (patch)
tree0aba021e0748ebad2197ea390385ec5f93ccbc6e /src/env.rs
parent1c40dc42e7bc7b799b77f06d25414aca59a044ba (diff)
Move and rename many things 🚛
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/env.rs b/src/env.rs
index a3e14715..58c44a5f 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -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(),