From e3f89490c62be8a6dab1840689964a8a0b4ff65a Mon Sep 17 00:00:00 2001 From: zroug <37004975+zroug@users.noreply.github.com> Date: Tue, 10 Jul 2018 17:21:06 +0200 Subject: [PATCH] Expose ability to read tags to crate users --- src/decoder/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 6cb4da1..045944a 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -15,7 +15,7 @@ use self::stream::{ PackBitsReader }; -mod ifd; +pub mod ifd; mod stream; /// Result of a decoding process @@ -344,7 +344,7 @@ impl Decoder { /// Tries to retrieve a tag. /// Return `Ok(None)` if the tag is not present. - fn find_tag(&mut self, tag: ifd::Tag) -> TiffResult> { + pub fn find_tag(&mut self, tag: ifd::Tag) -> TiffResult> { let ifd: &Directory = unsafe { let ifd = self.ifd.as_ref().unwrap(); // Ok to fail // Get a immutable borrow of self @@ -359,7 +359,7 @@ impl Decoder { } /// Tries to retrieve a tag and convert it to the desired type. - fn find_tag_u32(&mut self, tag: ifd::Tag) -> TiffResult> { + pub fn find_tag_u32(&mut self, tag: ifd::Tag) -> TiffResult> { match self.find_tag(tag)? { Some(val) => val.into_u32().map(Some), None => Ok(None) @@ -367,7 +367,7 @@ impl Decoder { } /// Tries to retrieve a tag and convert it to the desired type. - fn find_tag_u32_vec(&mut self, tag: ifd::Tag) -> TiffResult>> { + pub fn find_tag_u32_vec(&mut self, tag: ifd::Tag) -> TiffResult>> { match self.find_tag(tag)? { Some(val) => val.into_u32_vec().map(Some), None => Ok(None) @@ -376,7 +376,7 @@ impl Decoder { /// Tries to retrieve a tag. /// Returns an error if the tag is not present - fn get_tag(&mut self, tag: ifd::Tag) -> TiffResult { + pub fn get_tag(&mut self, tag: ifd::Tag) -> TiffResult { match try!(self.find_tag(tag)) { Some(val) => Ok(val), None => Err(TiffError::FormatError(format!( @@ -386,12 +386,12 @@ impl Decoder { } /// Tries to retrieve a tag and convert it to the desired type. - fn get_tag_u32(&mut self, tag: ifd::Tag) -> TiffResult { + pub fn get_tag_u32(&mut self, tag: ifd::Tag) -> TiffResult { self.get_tag(tag)?.into_u32() } /// Tries to retrieve a tag and convert it to the desired type. - fn get_tag_u32_vec(&mut self, tag: ifd::Tag) -> TiffResult> { + pub fn get_tag_u32_vec(&mut self, tag: ifd::Tag) -> TiffResult> { self.get_tag(tag)?.into_u32_vec() }