From 6aa5f3add5318572332c08d4989ac52d2f6348c6 Mon Sep 17 00:00:00 2001 From: Birk Tjelmeland Date: Fri, 8 Feb 2019 21:05:25 +0100 Subject: [PATCH] Made `DecodingBuffer` public Marked `DecodingBuffer` and `read_strip_to_buffer` as public to reduce copies in eventual `TiffReader`. --- src/decoder/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 393be17..1cd8542 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -28,7 +28,7 @@ pub enum DecodingResult { } impl DecodingResult { - fn to_buffer(&mut self, start: usize) -> DecodingBuffer { + pub fn to_buffer(&mut self, start: usize) -> DecodingBuffer { match self { DecodingResult::U8(ref mut buf) => DecodingBuffer::U8(&mut buf[start..]), DecodingResult::U16(ref mut buf) => DecodingBuffer::U16(&mut buf[start..]), @@ -37,7 +37,7 @@ impl DecodingResult { } // A buffer for image decoding -enum DecodingBuffer<'a> { +pub enum DecodingBuffer<'a> { /// A slice of unsigned bytes U8(&'a mut [u8]), /// A slice of unsigned words @@ -488,7 +488,7 @@ impl Decoder { Ok(()) } - fn read_strip_to_buffer(&mut self, mut buffer: DecodingBuffer) -> TiffResult<()> { + pub fn read_strip_to_buffer(&mut self, mut buffer: DecodingBuffer) -> TiffResult<()> { self.initialize_strip_decoder()?; let index = self.strip_decoder.as_ref().unwrap().strip_index;