diff --git a/src/decoder.rs b/src/decoder.rs index 26fdc30..fea0900 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -89,20 +89,6 @@ where run_len: 0, }) } - - fn new(bytes: I) -> Self { - Self { - back_buffer: [PixelRGBA::zero(); 64], - prev_pixel: PixelRGBA { - r: 0, - g: 0, - b: 0, - a: 255, - }, - bytes, - run_len: 0, - } - } } impl<'input, I> Iterator for Decoder @@ -230,6 +216,23 @@ mod test { } } + // The decoder includes image metadata, now, and construction attempts + // to extract it from the input iterator. For the decoder tests, this + // needs to be skipped. Thus, we get *another* magic constructor + // available only to the test module. + fn new_with_no_metadata(bytes: I) -> Self { + Self { + width: 0, + height: 0, + channels: 4, + colorspace: 0, + back_buffer: [PixelRGBA::zero(); 64], + prev_pixel: PixelRGBA { r: 0, g: 0, b: 0, a: 255 }, + bytes, + run_len: 0, + } + } + fn peek_prev_pixel(&self) -> &PixelRGBA { &self.prev_pixel }