Fix the issue with the new version of image
- ID
8296560- date
2024-05-12 09:24:59+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
0b4a627- message
Fix the issue with the new version of image I was getting an error from the compiler: ``` 52 | pub struct GifDecoder<R: Read> { | ------------------------------ doesn't satisfy `GifDecoder<File>: AnimationDecoder<'_>` | = note: the following trait bounds were not satisfied: `File: BufRead` which is required by `GifDecoder<File>: AnimationDecoder<'_>` ``` and reading the documentation for this trait, it sounds like I need to wrap my `File` in a `BufRead`. https://doc.rust-lang.org/std/io/trait.BufRead.html- changed files
1 file, 3 additions
Changed files
src/get_bytes.rs (4306) → src/get_bytes.rs (4362)
diff --git a/src/get_bytes.rs b/src/get_bytes.rs
index eb90bba..f028477 100644
--- a/src/get_bytes.rs
+++ b/src/get_bytes.rs
@@ -1,4 +1,5 @@
use std::fs::File;
+use std::io::BufReader;
use image::codecs::gif::GifDecoder;
use image::imageops::FilterType;
@@ -42,6 +43,8 @@ pub fn get_bytes_for_gif(path: &str) -> Vec<u8> {
}
};
+ let f = BufReader::new(f);
+
let decoder = GifDecoder::new(f).ok().unwrap();
// If the GIF is animated, we want to make sure we look at multiple