Skip to content

Commit

Permalink
Drop useless PhantomData that no longer does anything useful
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnatsel committed Feb 12, 2024
1 parent 5607588 commit 99ac378
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/codecs/jpeg/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::io::Read;
use std::marker::PhantomData;

use crate::color::ColorType;
use crate::error::{
Expand All @@ -11,20 +10,17 @@ use crate::io::Limits;
type ZuneColorSpace = zune_core::colorspace::ColorSpace;

/// JPEG decoder
pub struct JpegDecoder<R> {
pub struct JpegDecoder {
input: Vec<u8>,
orig_color_space: ZuneColorSpace,
width: u16,
height: u16,
limits: Limits,
// For API compatibility with the previous jpeg_decoder wrapper.
// Can be removed later, which would be an API break.
phantom: PhantomData<R>,
}

impl<R: Read> JpegDecoder<R> {
impl JpegDecoder {
/// Create a new decoder that decodes from the stream ```r```
pub fn new(r: R) -> ImageResult<JpegDecoder<R>> {
pub fn new<R: Read>(r: R) -> ImageResult<JpegDecoder> {
let mut input = Vec::new();
let mut r = r;
r.read_to_end(&mut input)?;
Expand All @@ -45,12 +41,11 @@ impl<R: Read> JpegDecoder<R> {
width,
height,
limits,
phantom: PhantomData,
})
}
}

impl<R: Read> ImageDecoder for JpegDecoder<R> {
impl ImageDecoder for JpegDecoder {
fn dimensions(&self) -> (u32, u32) {
(u32::from(self.width), u32::from(self.height))
}
Expand Down

0 comments on commit 99ac378

Please sign in to comment.