From 130a75d0cadeff05710676ba582791a60e8362a7 Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Sat, 19 Apr 2025 19:32:31 -0400 Subject: [PATCH] remove Sized requirement --- bingus/Cargo.toml | 2 +- bingus/src/bin_/bytes.rs | 5 +---- bingus/src/doc/pdf.rs | 5 +---- bingus/src/doc/shiva.rs | 5 +---- bingus/src/fnt/fontkit.rs | 5 +---- bingus/src/img/image.rs | 10 ++-------- bingus/src/lib.rs | 5 +---- bingus/src/snd/raw.rs | 5 +---- bingus/src/txt/bare.rs | 5 +---- 9 files changed, 10 insertions(+), 37 deletions(-) diff --git a/bingus/Cargo.toml b/bingus/Cargo.toml index 557029b..5ccaad8 100644 --- a/bingus/Cargo.toml +++ b/bingus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bingus" -version = "0.4.0" +version = "0.4.1" edition.workspace = true license.workspace = true description.workspace = true diff --git a/bingus/src/bin_/bytes.rs b/bingus/src/bin_/bytes.rs index 472d0b4..74a0b03 100644 --- a/bingus/src/bin_/bytes.rs +++ b/bingus/src/bin_/bytes.rs @@ -19,10 +19,7 @@ impl TryFromDataBytes for Bytes { bytes: Bytes, _: Self::Format, _: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { Ok(bytes) } } diff --git a/bingus/src/doc/pdf.rs b/bingus/src/doc/pdf.rs index 02a39f5..0e9b26d 100644 --- a/bingus/src/doc/pdf.rs +++ b/bingus/src/doc/pdf.rs @@ -24,10 +24,7 @@ impl TryFromDataBytes for PdfDocument { bytes: crate::Bytes, _format: Self::Format, _crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { let mut warnings = Vec::new(); let result = PdfDocument::parse( &bytes, diff --git a/bingus/src/doc/shiva.rs b/bingus/src/doc/shiva.rs index cde0f74..2a98422 100644 --- a/bingus/src/doc/shiva.rs +++ b/bingus/src/doc/shiva.rs @@ -26,10 +26,7 @@ impl TryFromDataBytes for ShivaDocument { bytes: crate::Bytes, format: Self::Format, _crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { Ok(ShivaDocument::new( Document::parse(&Bytes::from(bytes), format.input_format)?, format.output_format, diff --git a/bingus/src/fnt/fontkit.rs b/bingus/src/fnt/fontkit.rs index b8a28e0..bf44dcf 100644 --- a/bingus/src/fnt/fontkit.rs +++ b/bingus/src/fnt/fontkit.rs @@ -13,10 +13,7 @@ impl TryFromDataBytes for Font { bytes: crate::Bytes, _format: Self::Format, _crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { Self::from_bytes(Arc::new(bytes), 0) } } diff --git a/bingus/src/img/image.rs b/bingus/src/img/image.rs index b00a421..e2a0f66 100644 --- a/bingus/src/img/image.rs +++ b/bingus/src/img/image.rs @@ -127,10 +127,7 @@ where bytes: crate::Bytes, format: Self::Format, crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { ImageBuffer::from_raw( format.width, format.height, @@ -213,10 +210,7 @@ impl TryFromDataBytes for DynamicImage { bytes: crate::Bytes, format: Self::Format, crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { match format.1 { ColorType::L8 => Ok(DynamicImage::ImageLuma8(ImageBuffer::from_data_bytes( bytes, format.0, crop, diff --git a/bingus/src/lib.rs b/bingus/src/lib.rs index 3ebc284..422b821 100644 --- a/bingus/src/lib.rs +++ b/bingus/src/lib.rs @@ -357,10 +357,7 @@ where T: TryFromDataBytes, { type Format = ::Format; - fn from_data_bytes(bytes: Bytes, format: Self::Format, crop: Crop) -> Self - where - Self: Sized, - { + fn from_data_bytes(bytes: Bytes, format: Self::Format, crop: Crop) -> Self { T::try_from_data_bytes(bytes, format, crop).unwrap_or_else(|_| unreachable!()) } } diff --git a/bingus/src/snd/raw.rs b/bingus/src/snd/raw.rs index 0557eb6..6a01b62 100644 --- a/bingus/src/snd/raw.rs +++ b/bingus/src/snd/raw.rs @@ -40,10 +40,7 @@ where bytes: crate::Bytes, _format: Self::Format, crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { Ok(match crop { crate::Crop::End => bytes .chunks_exact(T::zero().to_ne_bytes().as_ref().len()) diff --git a/bingus/src/txt/bare.rs b/bingus/src/txt/bare.rs index 9cbb537..5cb3beb 100644 --- a/bingus/src/txt/bare.rs +++ b/bingus/src/txt/bare.rs @@ -11,10 +11,7 @@ impl TryFromDataBytes for Text<'_> { bytes: Bytes, _format: Self::Format, _crop: crate::Crop, - ) -> Result - where - Self: Sized, - { + ) -> Result { String::from_utf8(bytes).map(Into::into) } }