summaryrefslogtreecommitdiff
path: root/src/image.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-25 11:16:03 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-25 11:16:03 +0200
commit3309ff9fe5ea36134e8ddf11ac2c84613b569856 (patch)
treeb3eb48d444a5dee7273a76c548a64be96d76f0b9 /src/image.rs
parent362a7f2a8ac76f944efa05eabcab0960817777c5 (diff)
Slim down context
Diffstat (limited to 'src/image.rs')
-rw-r--r--src/image.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/image.rs b/src/image.rs
index 87c093d3..1392ecf1 100644
--- a/src/image.rs
+++ b/src/image.rs
@@ -48,6 +48,16 @@ impl ImageStore {
}
}
+ /// Get a reference to a loaded image.
+ ///
+ /// This panics if no image with this `id` was loaded. This function should
+ /// only be called with ids returned by this store's [`load()`](Self::load)
+ /// method.
+ #[track_caller]
+ pub fn get(&self, id: ImageId) -> &Image {
+ &self.images[id.0 as usize]
+ }
+
/// Load and decode an image file from a path relative to the compilation
/// environment's root.
pub fn load(&mut self, path: &Path) -> io::Result<ImageId> {
@@ -64,16 +74,6 @@ impl ImageStore {
}
})
}
-
- /// Get a reference to a loaded image.
- ///
- /// This panics if no image with this `id` was loaded. This function should
- /// only be called with ids returned by this store's [`load()`](Self::load)
- /// method.
- #[track_caller]
- pub fn get(&self, id: ImageId) -> &Image {
- &self.images[id.0 as usize]
- }
}
/// A loaded image.