Skip to main content

Rules

Trait Rules 

Source
pub trait Rules {
Show 17 methods // Required methods fn follows(&self, w: &Walk<'_>, parent: &Ifd, kind: Kind, e: &Entry) -> bool; fn follows_next(&self, w: &Walk<'_>, ifd: &Ifd, kind: Kind) -> bool; fn ifd(&self, w: &Walk<'_>, ifd: &Ifd) -> Fate; fn entry(&self, w: &Walk<'_>, ifd: &Ifd, index: usize) -> Fate; fn image_data(&self, w: &Walk<'_>, ifd: &Ifd) -> Fate; fn jpeg_stream(&self, w: &Walk<'_>, ifd: &Ifd) -> Fate; // Provided methods fn magic(&self, _magic: u16) -> bool { ... } fn header_extension(&self, _w: &Walk<'_>) -> Option<(u64, Fate)> { ... } fn value_tail( &self, _w: &Walk<'_>, _ifd: &Ifd, _index: usize, ) -> Option<(u64, Fate)> { ... } fn chunk_use( &self, w: &Walk<'_>, ifd: &Ifd, tiles: bool, offs: &[u64], cnts: &[u64], ) -> Vec<ChunkUse> { ... } fn pointer(&self, kind: Kind, e: &Entry) -> Option<(Kind, &'static str)> { ... } fn pointer_offsets(&self, w: &Walk<'_>, e: &Entry, max: usize) -> Vec<u64> { ... } fn value(&self, w: &Walk<'_>, ifd: &Ifd, index: usize) -> Fate { ... } fn jpeg_table(&self, _w: &Walk<'_>, _ifd: &Ifd, _tag: u16) -> Fate { ... } fn cancelled(&self) -> bool { ... } fn rejects( &self, _w: &Walk<'_>, _at: u64, _kind: Kind, ) -> Option<&'static str> { ... } fn extents(&self, w: &Walk<'_>, ifd: &Ifd) -> Vec<ExtentRule> { ... }
}
Expand description

What one decode path does with a TIFF’s directories, entries and extents.

Required Methods§

Source

fn follows(&self, w: &Walk<'_>, parent: &Ifd, kind: Kind, e: &Entry) -> bool

Whether the decode path reads the directory the pointer entry e of parent, reached as a kind directory, leads to.

Source

fn follows_next(&self, w: &Walk<'_>, ifd: &Ifd, kind: Kind) -> bool

Whether the decode path reads the directory the next pointer of ifd, reached as a kind directory, leads to.

Source

fn ifd(&self, w: &Walk<'_>, ifd: &Ifd) -> Fate

Source

fn entry(&self, w: &Walk<'_>, ifd: &Ifd, index: usize) -> Fate

The entry (and, unless value says otherwise, its out-of-line value).

Source

fn image_data(&self, w: &Walk<'_>, ifd: &Ifd) -> Fate

Strips and tiles.

Source

fn jpeg_stream(&self, w: &Walk<'_>, ifd: &Ifd) -> Fate

A JPEG stream located by JPEGInterchangeFormat (513/514).

Provided Methods§

Source

fn magic(&self, _magic: u16) -> bool

Accept a TIFF version number other than 42 and 43 (ORF, RW2).

Source

fn header_extension(&self, _w: &Walk<'_>) -> Option<(u64, Fate)>

Bytes after the classic 8-byte header that the file format defines (CR2), and what the decode path does with them.

Source

fn value_tail( &self, _w: &Walk<'_>, _ifd: &Ifd, _index: usize, ) -> Option<(u64, Fate)>

For a value the decode path consumes only in part: how many leading bytes it uses, and the fate of the rest (an ASCII value’s bytes after its NUL, for example).

Source

fn chunk_use( &self, w: &Walk<'_>, ifd: &Ifd, tiles: bool, offs: &[u64], cnts: &[u64], ) -> Vec<ChunkUse>

How much of each strip or tile, located at offs with declared lengths cnts, the decoder reads. The default follows image-tiff: default_chunk_use.

Source

fn pointer(&self, kind: Kind, e: &Entry) -> Option<(Kind, &'static str)>

The directory pointer entry e in a kind IFD leads to.

Source

fn pointer_offsets(&self, w: &Walk<'_>, e: &Entry, max: usize) -> Vec<u64>

The TIFF-relative offsets a pointer entry holds, at most max of them (the walk reads only as many as it can still queue).

Source

fn value(&self, w: &Walk<'_>, ifd: &Ifd, index: usize) -> Fate

The entry’s out-of-line value.

Source

fn jpeg_table(&self, _w: &Walk<'_>, _ifd: &Ifd, _tag: u16) -> Fate

External old-style JPEG tables (519, 520 or 521). Locating a table does not establish that the decoder uses it: an embedded JPEG header can supply tables instead. The default deliberately leaves consumption unknown, independently of strips and JPEGInterchangeFormat streams.

Override only when the codec’s rules establish the same disposition for every table reached by this tag. This is not privacy evidence.

Source

fn cancelled(&self) -> bool

Whether the caller’s stop token asks the walk to end early.

Source

fn rejects(&self, _w: &Walk<'_>, _at: u64, _kind: Kind) -> Option<&'static str>

Why the decoder rejects the directory at absolute offset at, reached as kind, before reading its entries (an entry-count cap), if it does. Such a directory is walked as not followed.

Source

fn extents(&self, w: &Walk<'_>, ifd: &Ifd) -> Vec<ExtentRule>

Extents ifd locates. The default covers strips, tiles, free space and JPEGInterchangeFormat streams and external JPEG tables of image IFDs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§