Skip to main content

Directory

Struct Directory 

Source
pub struct Directory<'a> { /* private fields */ }
Expand description

A validated GContainer directory and its source packet.

Supports Google Photos and Dynamic Depth namespaces, including aliases. A directory must start with exactly one primary, and each secondary must have a unique semantic, MIME type and decimal length. At most 256 items are accepted. Unknown fields remain untouched during editing.

Implementations§

Source§

impl<'a> Directory<'a>

Source

pub fn parse(xml: &'a str) -> Result<Self, Error>

Parse a complete namespace-bound XMP packet. A packet without a directory is valid and has no items. Malformed or ambiguous XML fails.

Source

pub fn items(&self) -> impl ExactSizeIterator<Item = &ContainerItem>

Items in directory order, including the primary.

Source

pub fn rewrite_item_lengths( &self, secondaries: &[(&str, usize)], ) -> Result<String, Error>

Replace secondary lengths by semantic and set secondary padding to zero.

The caller supplies the final payload lengths. Unlisted payloads (such as MPF thumbnails) are allowed, but every directory secondary must match exactly one supplied semantic. Primary fields and all bytes outside the selected numeric values are retained. Element content, including CDATA, is replaced by decimal text; attribute quote style is retained.

Auto Trait Implementations§

§

impl<'a> Freeze for Directory<'a>

§

impl<'a> RefUnwindSafe for Directory<'a>

§

impl<'a> Send for Directory<'a>

§

impl<'a> Sync for Directory<'a>

§

impl<'a> Unpin for Directory<'a>

§

impl<'a> UnsafeUnpin for Directory<'a>

§

impl<'a> UnwindSafe for Directory<'a>

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.