remove Sized requirement

This commit is contained in:
Breval Ferrari 2025-04-19 19:32:31 -04:00
parent 2a93d99841
commit 130a75d0ca
Signed by: breval
GPG key ID: A2EEBF62257FF960
9 changed files with 10 additions and 37 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "bingus"
version = "0.4.0"
version = "0.4.1"
edition.workspace = true
license.workspace = true
description.workspace = true

View file

@ -19,10 +19,7 @@ impl TryFromDataBytes for Bytes {
bytes: Bytes,
_: Self::Format,
_: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
Ok(bytes)
}
}

View file

@ -24,10 +24,7 @@ impl TryFromDataBytes for PdfDocument {
bytes: crate::Bytes,
_format: Self::Format,
_crop: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
let mut warnings = Vec::new();
let result = PdfDocument::parse(
&bytes,

View file

@ -26,10 +26,7 @@ impl TryFromDataBytes for ShivaDocument {
bytes: crate::Bytes,
format: Self::Format,
_crop: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
Ok(ShivaDocument::new(
Document::parse(&Bytes::from(bytes), format.input_format)?,
format.output_format,

View file

@ -13,10 +13,7 @@ impl TryFromDataBytes for Font {
bytes: crate::Bytes,
_format: Self::Format,
_crop: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
Self::from_bytes(Arc::new(bytes), 0)
}
}

View file

@ -127,10 +127,7 @@ where
bytes: crate::Bytes,
format: Self::Format,
crop: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
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<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
match format.1 {
ColorType::L8 => Ok(DynamicImage::ImageLuma8(ImageBuffer::from_data_bytes(
bytes, format.0, crop,

View file

@ -357,10 +357,7 @@ where
T: TryFromDataBytes<Error = Infallible, Format = F>,
{
type Format = <T as TryFromDataBytes>::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!())
}
}

View file

@ -40,10 +40,7 @@ where
bytes: crate::Bytes,
_format: Self::Format,
crop: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
Ok(match crop {
crate::Crop::End => bytes
.chunks_exact(T::zero().to_ne_bytes().as_ref().len())

View file

@ -11,10 +11,7 @@ impl TryFromDataBytes for Text<'_> {
bytes: Bytes,
_format: Self::Format,
_crop: crate::Crop,
) -> Result<Self, Self::Error>
where
Self: Sized,
{
) -> Result<Self, Self::Error> {
String::from_utf8(bytes).map(Into::into)
}
}