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>
impl<'a> Directory<'a>
Sourcepub fn parse(xml: &'a str) -> Result<Self, Error>
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.
Sourcepub fn items(&self) -> impl ExactSizeIterator<Item = &ContainerItem>
pub fn items(&self) -> impl ExactSizeIterator<Item = &ContainerItem>
Items in directory order, including the primary.
Sourcepub fn rewrite_item_lengths(
&self,
secondaries: &[(&str, usize)],
) -> Result<String, Error>
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.