pub struct FormatMetadata { /* private fields */ }Expand description
Structured metadata attached to transforms and baked outputs.
Implementations§
Source§impl FormatMetadata
impl FormatMetadata
Sourcepub fn to_native_string(&self) -> Result<String>
pub fn to_native_string(&self) -> Result<String>
Format metadata using OCIO’s native stream operator. This is diagnostic text, not an XML serializer, and is copied into a Rust-owned string.
Sourcepub fn element_name(&self) -> Option<String>
pub fn element_name(&self) -> Option<String>
Get the element name.
Sourcepub fn try_element_name(&self) -> Result<Option<String>>
pub fn try_element_name(&self) -> Result<Option<String>>
Get the element name, reporting an invalidated handle.
Sourcepub fn element_value(&self) -> Option<String>
pub fn element_value(&self) -> Option<String>
Get the element value.
Sourcepub fn try_element_value(&self) -> Result<Option<String>>
pub fn try_element_value(&self) -> Result<Option<String>>
Get the element value, reporting an invalidated handle.
Sourcepub fn num_attributes(&self) -> i32
pub fn num_attributes(&self) -> i32
Get the number of attributes on this metadata element.
Sourcepub fn try_num_attributes(&self) -> Result<i32>
pub fn try_num_attributes(&self) -> Result<i32>
Get the attribute count, reporting an invalidated handle.
Sourcepub fn attribute_name(&self, i: i32) -> Option<String>
pub fn attribute_name(&self, i: i32) -> Option<String>
Get the attribute name at the given index.
Sourcepub fn try_attribute_name(&self, i: i32) -> Result<Option<String>>
pub fn try_attribute_name(&self, i: i32) -> Result<Option<String>>
Get an attribute name, reporting an invalidated handle.
Sourcepub fn attribute_value_by_index(&self, i: i32) -> Option<String>
pub fn attribute_value_by_index(&self, i: i32) -> Option<String>
Get the attribute value at the given index.
Sourcepub fn try_attribute_value_by_index(&self, i: i32) -> Result<Option<String>>
pub fn try_attribute_value_by_index(&self, i: i32) -> Result<Option<String>>
Get an attribute value by index, preserving OCIO query failures.
Sourcepub fn attribute_value(&self, name: impl AsRef<str>) -> Option<String>
pub fn attribute_value(&self, name: impl AsRef<str>) -> Option<String>
Get the attribute value by name.
Sourcepub fn try_attribute_value(
&self,
name: impl AsRef<str>,
) -> Result<Option<String>>
pub fn try_attribute_value( &self, name: impl AsRef<str>, ) -> Result<Option<String>>
Get an attribute value by name, preserving invalid input and OCIO failures.
Sourcepub fn add_attribute(
&self,
name: impl AsRef<str>,
value: impl AsRef<str>,
) -> Result<()>
pub fn add_attribute( &self, name: impl AsRef<str>, value: impl AsRef<str>, ) -> Result<()>
Add a name-value attribute to this metadata element.
Sourcepub fn num_children(&self) -> i32
pub fn num_children(&self) -> i32
Get the number of child elements.
Sourcepub fn try_num_children(&self) -> Result<i32>
pub fn try_num_children(&self) -> Result<i32>
Get the child count, reporting an invalidated handle.
Sourcepub fn child_element(&self, i: i32) -> Option<FormatMetadata>
pub fn child_element(&self, i: i32) -> Option<FormatMetadata>
Get a live child element at the given index.
The wrapper remains usable when siblings are appended. Clearing an ancestor invalidates it: subsequent fallible operations return an error even if a new child later occupies the same index.
Sourcepub fn try_child_element(&self, i: i32) -> Result<Option<FormatMetadata>>
pub fn try_child_element(&self, i: i32) -> Result<Option<FormatMetadata>>
Get a live child element by index, preserving OCIO query failures.
See Self::child_element for invalidation behavior.
Sourcepub fn add_child_element(
&self,
name: impl AsRef<str>,
value: impl AsRef<str>,
) -> Result<()>
pub fn add_child_element( &self, name: impl AsRef<str>, value: impl AsRef<str>, ) -> Result<()>
Add a child element with the given name and value.
Sourcepub fn try_clear(&self) -> Result<()>
pub fn try_clear(&self) -> Result<()>
Clear this element and invalidate all previously obtained descendants.
Sourcepub fn assign(&self, source: &FormatMetadata) -> Result<()>
pub fn assign(&self, source: &FormatMetadata) -> Result<()>
Replace this element with a deep copy of source, matching native
metadata assignment. Existing descendants of this element are
invalidated, including if native assignment fails after it begins.
Assigning an element to itself is a no-op. Overlapping source and
destination trees are supported by snapshotting the source first.
Sourcepub fn assign_const(&self, source: &ConstFormatMetadata) -> Result<()>
pub fn assign_const(&self, source: &ConstFormatMetadata) -> Result<()>
Replace this element with a copy of processor-owned read-only metadata.
This copies directly from the native processor metadata without first creating an editable intermediate. Existing descendants are invalidated before assignment, including if native assignment subsequently fails.
Sourcepub fn try_name(&self) -> Result<Option<String>>
pub fn try_name(&self) -> Result<Option<String>>
Get the name attribute, reporting an invalidated handle.
Sourcepub fn set_name(&self, name: impl AsRef<str>) -> Result<()>
pub fn set_name(&self, name: impl AsRef<str>) -> Result<()>
Set the name of this metadata element.