Deprecate unusable structs without a public constructor

This commit is contained in:
Kornel 2024-06-28 12:17:24 +01:00
parent 924b501f97
commit 79177cd482
No known key found for this signature in database
3 changed files with 7 additions and 0 deletions

View file

@ -68,7 +68,10 @@ impl<R: Read> GifDecoder<R> {
}
/// Wrapper struct around a `Cursor<Vec<u8>>`
#[allow(dead_code)]
#[deprecated]
pub struct GifReader<R>(Cursor<Vec<u8>>, PhantomData<R>);
#[allow(deprecated)]
impl<R> Read for GifReader<R> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)

View file

@ -167,7 +167,10 @@ impl ImageError {
}
/// Wrapper struct around a `Cursor<Vec<u8>>`
#[allow(dead_code)]
#[deprecated]
pub struct TiffReader<R>(Cursor<Vec<u8>>, PhantomData<R>);
#[allow(deprecated)]
impl<R> Read for TiffReader<R> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)

View file

@ -1395,6 +1395,7 @@ mod test {
// Test that structs wrapping a DynamicImage are able to auto-derive the Default trait
// ensures that DynamicImage implements Default (if it didn't, this would cause a compile error).
#[derive(Default)]
#[allow(dead_code)]
struct Foo {
_image: super::DynamicImage,
}