Struct Directory

pub struct Directory { /* private fields */ }

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

impl Directory

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.

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

Retrieve the value associated with a tag.

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

Check if the directory contains a specified tag.

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

Iterate over all known and unknown tags in this directory.

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.

fn len(&self) -> usize

Get the number of entries.

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.

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

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

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

Trait Implementations

impl Debug for Directory

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

impl FromIterator<(Tag, Entry)> for Directory

fn from_iter<T: IntoIterator<Item = (Tag, Entry)>>(iter: T) -> Self

Auto Trait Implementations

impl Freeze for Directory

impl RefUnwindSafe for Directory

impl Send for Directory

impl Sync for Directory

impl Unpin for Directory

impl UnsafeUnpin for Directory

impl UnwindSafe for Directory

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for Directory where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for Directory where ST: ?Sized, DT: ?Sized,

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for Directory

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Read<Exclusive, BecauseExclusive> for Directory where T: ?Sized,

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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