pub struct TiffMetadataReader { /* private fields */ }Expand description
Entry point to reading TIFF metadata.
This is a stateful reader because we don’t know how many IFDs will be encountered.
// fetch implements MetadataFetch
let mut metadata_reader = TiffMetadataReader::try_open(&fetch).await?;
let ifds = metadata_reader.read_all_ifds(&fetch).await?;Implementations§
Source§impl TiffMetadataReader
impl TiffMetadataReader
Sourcepub async fn try_open<F: MetadataFetch>(fetch: &F) -> AsyncTiffResult<Self>
pub async fn try_open<F: MetadataFetch>(fetch: &F) -> AsyncTiffResult<Self>
Open a new TIFF file, validating the magic bytes, reading the endianness, and checking for the bigtiff flag.
This does not read any IFD metadata.
Sourcepub fn endianness(&self) -> Endianness
pub fn endianness(&self) -> Endianness
Returns the endianness of the file.
Sourcepub fn has_next_ifd(&self) -> bool
pub fn has_next_ifd(&self) -> bool
Returns true if there are more IFDs to read.
Sourcepub fn next_ifd_offset(&self) -> Option<u64>
pub fn next_ifd_offset(&self) -> Option<u64>
The byte offset of the start of the next IFD.
This will be None if all IFDs have already been read.
Sourcepub async fn read_next_ifd<F: MetadataFetch>(
&mut self,
fetch: &F,
) -> AsyncTiffResult<Option<ImageFileDirectory>>
pub async fn read_next_ifd<F: MetadataFetch>( &mut self, fetch: &F, ) -> AsyncTiffResult<Option<ImageFileDirectory>>
Read the next IFD from the file.
If there are no more IFDs, returns None.
Sourcepub async fn read_all_ifds<F: MetadataFetch>(
&mut self,
fetch: &F,
) -> AsyncTiffResult<Vec<ImageFileDirectory>>
pub async fn read_all_ifds<F: MetadataFetch>( &mut self, fetch: &F, ) -> AsyncTiffResult<Vec<ImageFileDirectory>>
Read all IFDs from the file.
Sourcepub async fn read<F: MetadataFetch>(
&mut self,
fetch: &F,
) -> AsyncTiffResult<TIFF>
pub async fn read<F: MetadataFetch>( &mut self, fetch: &F, ) -> AsyncTiffResult<TIFF>
Read all IFDs from the file and return a complete TIFF structure.
Auto Trait Implementations§
impl Freeze for TiffMetadataReader
impl RefUnwindSafe for TiffMetadataReader
impl Send for TiffMetadataReader
impl Sync for TiffMetadataReader
impl Unpin for TiffMetadataReader
impl UnwindSafe for TiffMetadataReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more