constify sprite function

This commit is contained in:
Corwin 2022-07-15 21:59:36 +01:00
parent 3b6ce1b2bd
commit ebc4e15f3d

View file

@ -249,8 +249,11 @@ impl Tag {
}
#[must_use]
pub fn sprite(&self, idx: usize) -> &'static Sprite {
&self.sprites()[idx]
pub const fn sprite(&self, idx: usize) -> &'static Sprite {
if idx >= self.len {
panic!("out of bounds access to sprite");
}
unsafe { &*self.sprites.add(idx) }
}
#[inline]