From bd0dccef3ae2a14ee0e14a7c6c2ba29a708f1896 Mon Sep 17 00:00:00 2001 From: "A. Molzer" <5550310+197g@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:52:06 +0100 Subject: [PATCH] Deprecate Decoder::*tag methods Funnel users towards the `IfdDecoder` instead. That type does not have a generic over the underlying reader. It also works with a directory of your own choosing. So the duplicates that should go are those directly on the decoder. --- src/decoder/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 53a64ba..c9f895f 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -1458,21 +1458,28 @@ impl Decoder { }, } } +} +#[doc(hidden = "Deprecated methods")] +#[allow(deprecated)] +impl Decoder { /// Tries to retrieve a tag from the current image directory. /// Return `Ok(None)` if the tag is not present. + #[deprecated = "Replace with `self.current_ifd().find_tag`"] pub fn find_tag(&mut self, tag: Tag) -> TiffResult> { self.current_ifd().find_tag(tag) } /// Tries to retrieve a tag in the current image directory and convert it to the desired /// unsigned type. + #[deprecated = "Replace with `self.current_ifd().find_tag_unsigned`"] pub fn find_tag_unsigned>(&mut self, tag: Tag) -> TiffResult> { self.current_ifd().find_tag_unsigned(tag) } /// Tries to retrieve a vector of all a tag's values and convert them to the desired unsigned /// type. + #[deprecated = "Replace with `self.current_ifd().find_tag_unsigned_vec`"] pub fn find_tag_unsigned_vec>( &mut self, tag: Tag, @@ -1482,67 +1489,81 @@ impl Decoder { /// Tries to retrieve a tag from the current image directory and convert it to the desired /// unsigned type. Returns an error if the tag is not present. + #[deprecated = "Replace with `self.current_ifd().get_tag_unsigned`"] pub fn get_tag_unsigned>(&mut self, tag: Tag) -> TiffResult { self.current_ifd().get_tag_unsigned(tag) } /// Tries to retrieve a tag from the current image directory. /// Returns an error if the tag is not present + #[deprecated = "Replace with `self.current_ifd().get_tag`"] pub fn get_tag(&mut self, tag: Tag) -> TiffResult { self.current_ifd().get_tag(tag) } + #[deprecated = "Replace with `self.current_ifd().get_tag_u32`"] pub fn get_tag_u32(&mut self, tag: Tag) -> TiffResult { self.get_tag(tag)?.into_u32() } + #[deprecated = "Replace with `self.current_ifd().get_tag_u64`"] pub fn get_tag_u64(&mut self, tag: Tag) -> TiffResult { self.get_tag(tag)?.into_u64() } /// Tries to retrieve a tag and convert it to the desired type. + #[deprecated = "Replace with `self.current_ifd().get_tag_f32`"] pub fn get_tag_f32(&mut self, tag: Tag) -> TiffResult { self.get_tag(tag)?.into_f32() } /// Tries to retrieve a tag and convert it to the desired type. + #[deprecated = "Replace with `self.current_ifd().get_tag_f64`"] pub fn get_tag_f64(&mut self, tag: Tag) -> TiffResult { self.get_tag(tag)?.into_f64() } /// Tries to retrieve a tag and convert it to the desired type. + #[deprecated = "Replace with `self.current_ifd().get_tag_u32_vec`"] pub fn get_tag_u32_vec(&mut self, tag: Tag) -> TiffResult> { self.get_tag(tag)?.into_u32_vec() } + #[deprecated = "Replace with `self.current_ifd().get_tag_u16_vec`"] pub fn get_tag_u16_vec(&mut self, tag: Tag) -> TiffResult> { self.get_tag(tag)?.into_u16_vec() } + #[deprecated = "Replace with `self.current_ifd().get_tag_u64_vec`"] pub fn get_tag_u64_vec(&mut self, tag: Tag) -> TiffResult> { self.get_tag(tag)?.into_u64_vec() } /// Tries to retrieve a tag and convert it to the desired type. + #[deprecated = "Replace with `self.current_ifd().get_tag_f32_vec`"] pub fn get_tag_f32_vec(&mut self, tag: Tag) -> TiffResult> { self.get_tag(tag)?.into_f32_vec() } /// Tries to retrieve a tag and convert it to the desired type. + #[deprecated = "Replace with `self.current_ifd().get_tag_f64_vec`"] pub fn get_tag_f64_vec(&mut self, tag: Tag) -> TiffResult> { self.get_tag(tag)?.into_f64_vec() } /// Tries to retrieve a tag and convert it to a 8bit vector. + #[deprecated = "Replace with `self.current_ifd().get_tag_u8_vec`"] pub fn get_tag_u8_vec(&mut self, tag: Tag) -> TiffResult> { self.get_tag(tag)?.into_u8_vec() } /// Tries to retrieve a tag and convert it to a ascii vector. + #[deprecated = "Replace with `self.current_ifd().get_tag_ascii_string`"] pub fn get_tag_ascii_string(&mut self, tag: Tag) -> TiffResult { self.get_tag(tag)?.into_string() } + #[deprecated = "Replace with `self.current_ifd().tag_iter`"] pub fn tag_iter(&mut self) -> impl Iterator> + '_ { self.current_ifd().tag_iter() }