pub enum Value {
}Expand description
The decoded value(s) of one IFD entry, one variant per crate::FieldType.
A TIFF entry always stores a count of values of a single type; even a scalar is a 1-element
vector here. On disk the values sit inline in the entry’s value/offset field when they fit, or
at a file offset otherwise — a distinction the reader/writer resolve, leaving this type purely
the logical value. The BigTIFF 64-bit variants (Long8/SLong8/Ifd8) appear only when the
bigtiff feature is enabled.
Variants§
Byte(Vec<u8>)
BYTE — unsigned 8-bit integers.
Ascii(String)
ASCII — a NUL-terminated 7-bit ASCII string (the terminator is not stored here).
Short(Vec<u16>)
SHORT — unsigned 16-bit integers.
Long(Vec<u32>)
LONG — unsigned 32-bit integers.
Rational(Vec<(u32, u32)>)
RATIONAL — unsigned fractions as (numerator, denominator) pairs.
SByte(Vec<i8>)
SBYTE — signed 8-bit integers.
Undefined(Vec<u8>)
UNDEFINED — raw bytes whose interpretation depends on the field.
SShort(Vec<i16>)
SSHORT — signed 16-bit integers.
SLong(Vec<i32>)
SLONG — signed 32-bit integers.
SRational(Vec<(i32, i32)>)
SRATIONAL — signed fractions as (numerator, denominator) pairs.
Float(Vec<f32>)
FLOAT — IEEE single-precision floats.
Double(Vec<f64>)
DOUBLE — IEEE double-precision floats.
Long8(Vec<u64>)
LONG8 — BigTIFF 64-bit unsigned integers.
SLong8(Vec<i64>)
SLONG8 — BigTIFF 64-bit signed integers.
Ifd8(Vec<u64>)
IFD8 — BigTIFF 64-bit IFD offsets.
Implementations§
Source§impl Value
impl Value
Sourcepub fn field_type(&self) -> FieldType
pub fn field_type(&self) -> FieldType
The field type of this value.
Sourcepub fn count(&self) -> usize
pub fn count(&self) -> usize
The Count of this value: the number of elements, or for ASCII the number of bytes
including the terminating NUL.
Sourcepub fn byte_len(&self) -> usize
pub fn byte_len(&self) -> usize
The number of bytes this value occupies on disk (count * type size).
Sourcepub fn as_u32(&self) -> Option<u32>
pub fn as_u32(&self) -> Option<u32>
Coerces a single unsigned-integer value (BYTE, SHORT, LONG, or — with bigtiff —
LONG8/IFD8) to u32.
TIFF readers accept any of these types for an integer field (TIFF 6.0 §2); returns None
if the value is not a single unsigned integer or a LONG8/IFD8 exceeds u32::MAX (only
possible past the 4 GiB classic-TIFF limit, which an in-memory decode cannot reach anyway).
Sourcepub fn as_u32_vec(&self) -> Option<Vec<u32>>
pub fn as_u32_vec(&self) -> Option<Vec<u32>>
Coerces an array of unsigned integers (BYTE, SHORT, LONG, or — with bigtiff —
LONG8/IFD8) to Vec<u32>.
Returns None for any other type, or if a LONG8/IFD8 element exceeds u32::MAX. This
lets a decoder read BigTIFF StripOffsets/StripByteCounts, which libtiff writes as
LONG8.