Add `TexturePoll::texture_id`

This commit is contained in:
Emil Ernerfeldt 2023-12-18 17:24:03 +01:00
parent 4060d02f27
commit 25903d0a02
1 changed files with 10 additions and 2 deletions

View File

@ -439,12 +439,20 @@ pub enum TexturePoll {
impl TexturePoll {
#[inline]
pub fn size(self) -> Option<Vec2> {
pub fn size(&self) -> Option<Vec2> {
match self {
TexturePoll::Pending { size } => size,
TexturePoll::Pending { size } => *size,
TexturePoll::Ready { texture } => Some(texture.size),
}
}
#[inline]
pub fn texture_id(&self) -> Option<TextureId> {
match self {
TexturePoll::Pending { .. } => None,
TexturePoll::Ready { texture } => Some(texture.id),
}
}
}
pub type TextureLoadResult = Result<TexturePoll>;