IfdEntry

Struct IfdEntry 

Source
pub struct IfdEntry {
    pub tag_id: u16,
    pub field_type: Option<FieldType>,
    pub field_type_raw: u16,
    pub count: u64,
    pub value_offset_bytes: Vec<u8>,
    pub is_inline: bool,
}
Expand description

A single entry in an IFD (Image File Directory).

Each entry describes one piece of metadata about the image. The value may be stored inline (in the value_offset field) or at a separate offset in the file.

§Classic TIFF Entry Layout (12 bytes)

Bytes 0-1:  Tag ID (u16)
Bytes 2-3:  Field type (u16)
Bytes 4-7:  Count (u32)
Bytes 8-11: Value or offset (u32)

§BigTIFF Entry Layout (20 bytes)

Bytes 0-1:   Tag ID (u16)
Bytes 2-3:   Field type (u16)
Bytes 4-11:  Count (u64)
Bytes 12-19: Value or offset (u64)

Fields§

§tag_id: u16

The tag ID (may be a known TiffTag or unknown)

§field_type: Option<FieldType>

The field type (None if unknown type)

§field_type_raw: u16

Raw field type value (for error reporting)

§count: u64

Number of values (not bytes!)

§value_offset_bytes: Vec<u8>

Raw bytes of the value/offset field. For classic TIFF: 4 bytes, for BigTIFF: 8 bytes. Contains either the actual value (if inline) or an offset to the value.

§is_inline: bool

Whether the value is stored inline (true) or at an offset (false)

Implementations§

Source§

impl IfdEntry

Source

pub fn tag(&self) -> Option<TiffTag>

Get the known TiffTag for this entry, if recognized.

Source

pub fn value_offset(&self, byte_order: ByteOrder) -> u64

Get the offset to the value data (for non-inline values).

§Arguments
  • byte_order - The byte order to use for reading
§Returns

The offset, or 0 if the value is inline (check is_inline first).

Source

pub fn inline_u16(&self, byte_order: ByteOrder) -> Option<u16>

Read inline value as a single u16.

§Arguments
  • byte_order - The byte order to use for reading
§Returns

The value, or None if not inline or count != 1 or wrong type.

Source

pub fn inline_u32(&self, byte_order: ByteOrder) -> Option<u32>

Read inline value as a single u32.

§Arguments
  • byte_order - The byte order to use for reading
§Returns

The value, or None if not inline or count != 1 or wrong type.

Source

pub fn inline_u64(&self, byte_order: ByteOrder) -> Option<u64>

Read inline value as a single u64.

§Arguments
  • byte_order - The byte order to use for reading
§Returns

The value, or None if not inline or count != 1 or wrong type.

Source

pub fn value_byte_size(&self) -> Option<u64>

Calculate total byte size of the value data.

Trait Implementations§

Source§

impl Clone for IfdEntry

Source§

fn clone(&self) -> IfdEntry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IfdEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more