remove Sized requirement
This commit is contained in:
parent
2a93d99841
commit
130a75d0ca
9 changed files with 10 additions and 37 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "bingus"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
description.workspace = true
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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!())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue