From d8e3fff57573db83a50dc08e4d20269ea14729ad Mon Sep 17 00:00:00 2001 From: Sophie Herold Date: Fri, 3 Jan 2025 16:35:31 +0100 Subject: [PATCH] gufo: Fix build without formats --- gufo/src/image.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gufo/src/image.rs b/gufo/src/image.rs index 885900a..3e4d257 100644 --- a/gufo/src/image.rs +++ b/gufo/src/image.rs @@ -33,15 +33,19 @@ impl Image { pub fn into_inner(self) -> Vec { match self { + #[cfg(feature = "jpeg")] Self::Jpeg(jpeg) => jpeg.into_inner(), + #[cfg(feature = "png")] Self::Png(png) => png.into_inner(), } } pub fn dyn_metadata(&self) -> Box<&dyn ImageMetadata> { - match self { - Self::Png(png) => Box::new(png as &dyn ImageMetadata), - Self::Jpeg(jpeg) => Box::new(jpeg as &dyn ImageMetadata), + match *self { + #[cfg(feature = "png")] + Self::Png(ref png) => Box::new(png as &dyn ImageMetadata), + #[cfg(feature = "jpeg")] + Self::Jpeg(ref jpeg) => Box::new(jpeg as &dyn ImageMetadata), } }