Refactor directory reading

This allows us to recombine the reader and other file data in a Decoder
with any IFD, whether that of an image or an extension IFD as indicated
by an IFD pointer such as Exif and GPS.
This commit is contained in:
A. Molzer committed 2025-07-11 14:12:34 +02:00
1 parent 6275b7a36d
commit 98cd3dc2d2
3 files changed
+398 -271

No files matched your search

+5 -2
View File
@@ -18,7 +18,7 @@ pub struct EndianReader<R> {
pub(crate) byte_order: ByteOrder,
}
impl<R: Read + Seek> EndianReader<R> {
impl<R: Read> EndianReader<R> {
pub fn new(reader: R, byte_order: ByteOrder) -> Self {
Self { reader, byte_order }
}
@@ -27,7 +27,10 @@ impl<R: Read + Seek> EndianReader<R> {
&mut self.reader
}
pub fn goto_offset(&mut self, offset: u64) -> io::Result<()> {
pub fn goto_offset(&mut self, offset: u64) -> io::Result<()>
where
R: Seek,
{
self.reader.seek(io::SeekFrom::Start(offset))?;
Ok(())
}