diff --git a/crates/egui/src/load.rs b/crates/egui/src/load.rs index b39e4812..ca668b26 100644 --- a/crates/egui/src/load.rs +++ b/crates/egui/src/load.rs @@ -439,12 +439,20 @@ pub enum TexturePoll { impl TexturePoll { #[inline] - pub fn size(self) -> Option { + pub fn size(&self) -> Option { match self { - TexturePoll::Pending { size } => size, + TexturePoll::Pending { size } => *size, TexturePoll::Ready { texture } => Some(texture.size), } } + + #[inline] + pub fn texture_id(&self) -> Option { + match self { + TexturePoll::Pending { .. } => None, + TexturePoll::Ready { texture } => Some(texture.id), + } + } } pub type TextureLoadResult = Result;