[go: up one dir, main page]

Directory

Struct Directory 

Source
pub struct Directory { /* private fields */ }
Expand description

An Image File Directory (IFD).

A directory is a map of Tags to Values. The values are stored anywhere in the file, with the directory containing the offsets and length of the associated values for each tag present in the directory.

A directory can be created with with Decoder::read_directory or as an empty directory to be extended with entries. A directory may be used with Decoder::read_directory_tags to read the values associated with tags from an underlying file.

Implementations§

Source§

impl Directory

Source

pub fn empty() -> Self

Create a directory in an initial state without entries. Note that an empty directory can not be encoded in a file, it must contain at least one entry.

Source

pub fn get(&self, tag: Tag) -> Option<&Entry>

Retrieve the value associated with a tag.

Source

pub fn contains(&self, tag: Tag) -> bool

Check if the directory contains a specified tag.

Source

pub fn iter(&self) -> impl Iterator<Item = (Tag, &Entry)> + '_

Iterate over all known and unknown tags in this directory.

Source

pub fn extend(&mut self, iter: impl IntoIterator<Item = (Tag, Entry)>)

Insert additional entries into the directory.

Note that a directory can contain at most u16::MAX values. There may be one entry that does not fit into the directory. This entry is silently ignored (please check Self::len to detect the condition). Providing a tag multiple times or a tag that already exists within this directory overwrites the entry.

Source

pub fn len(&self) -> usize

Get the number of entries.

Source

pub fn is_empty(&self) -> bool

Check if there are any entries in this directory. Note that an empty directory can not be encoded in the file, it must contain at least one entry.

Source

pub fn next(&self) -> Option<IfdPointer>

Get the pointer to the next IFD, if it was defined.

Source

pub fn set_next(&mut self, next: Option<IfdPointer>)

Trait Implementations§

Source§

impl Debug for Directory

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.