pub struct StructElement {
pub struct_type: String,
pub obj_type: Option<String>,
pub alt_text: Option<String>,
pub actual_text: Option<String>,
pub lang: Option<String>,
pub title: Option<String>,
pub id: Option<String>,
pub page_ref: Option<ObjectId>,
pub mcids: Vec<i64>,
pub children: Vec<StructElement>,
pub attributes: Vec<StructAttribute>,
pub parent_index: Option<usize>,
}Expand description
A single node in the structure tree.
Fields§
§struct_type: StringStructure type tag (e.g., “Document”, “P”, “H1”, “Table”, “Figure”).
obj_type: Option<String>Object type from /ObjType (e.g., “Elem”, “MCR”, “OBJR”).
Corresponds to upstream CPDF_StructElement::GetObjType().
alt_text: Option<String>Alternative text (/Alt).
actual_text: Option<String>Actual text (/ActualText).
lang: Option<String>Language tag (/Lang).
title: Option<String>Title (/T).
id: Option<String>Element identifier (/ID).
page_ref: Option<ObjectId>Page reference (/Pg) — indirect object ID.
mcids: Vec<i64>Marked content IDs associated with this element.
children: Vec<StructElement>Child structure elements.
attributes: Vec<StructAttribute>Attributes from the /A key.
parent_index: Option<usize>Index of this element within its parent’s children vec.
None for root elements (direct children of StructTree::root_elements).
For non-root elements, this is the zero-based index in the parent’s
children list, which can be used together with the parent reference to
navigate the tree upward.
Corresponds to upstream FPDF_StructElement_GetParent.
Implementations§
Source§impl StructElement
impl StructElement
Sourcepub fn struct_type(&self) -> &str
pub fn struct_type(&self) -> &str
Returns the structure type tag (e.g., “Document”, “P”, “H1”, “Table”, “Figure”).
Corresponds to upstream FPDF_StructElement_GetType.
Sourcepub fn struct_element_get_type(&self) -> &str
pub fn struct_element_get_type(&self) -> &str
ADR-019 Tier 2 alias for struct_type().
Corresponds to upstream FPDF_StructElement_GetType.
Sourcepub fn get_type(&self) -> &str
👎Deprecated since 0.1.0: use struct_element_get_type() — matches upstream FPDF_StructElement_GetType
pub fn get_type(&self) -> &str
use struct_element_get_type() — matches upstream FPDF_StructElement_GetType
Deprecated short alias — use struct_element_get_type()
or struct_type() instead.
Sourcepub fn obj_type(&self) -> Option<&str>
pub fn obj_type(&self) -> Option<&str>
Returns the object type (/ObjType), if present.
Typical values: "Elem", "MCR", "OBJR".
Corresponds to upstream FPDF_StructElement_GetObjType.
Sourcepub fn struct_element_get_obj_type(&self) -> Option<&str>
pub fn struct_element_get_obj_type(&self) -> Option<&str>
ADR-019 Tier 2 alias for obj_type().
Corresponds to upstream FPDF_StructElement_GetObjType.
Sourcepub fn get_obj_type(&self) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_obj_type() — matches upstream FPDF_StructElement_GetObjType
pub fn get_obj_type(&self) -> Option<&str>
use struct_element_get_obj_type() — matches upstream FPDF_StructElement_GetObjType
Deprecated short alias — use struct_element_get_obj_type()
or obj_type() instead.
Sourcepub fn alt_text(&self) -> Option<&str>
pub fn alt_text(&self) -> Option<&str>
Returns the alternative text (/Alt), if present.
Corresponds to upstream FPDF_StructElement_GetAltText.
Sourcepub fn struct_element_get_alt_text(&self) -> Option<&str>
pub fn struct_element_get_alt_text(&self) -> Option<&str>
ADR-019 Tier 2 alias for alt_text().
Corresponds to upstream FPDF_StructElement_GetAltText.
Sourcepub fn get_alt_text(&self) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_alt_text() — matches upstream FPDF_StructElement_GetAltText
pub fn get_alt_text(&self) -> Option<&str>
use struct_element_get_alt_text() — matches upstream FPDF_StructElement_GetAltText
Deprecated short alias — use struct_element_get_alt_text()
or alt_text() instead.
Sourcepub fn actual_text(&self) -> Option<&str>
pub fn actual_text(&self) -> Option<&str>
Returns the actual text (/ActualText), if present.
Corresponds to upstream FPDF_StructElement_GetActualText.
Sourcepub fn struct_element_get_actual_text(&self) -> Option<&str>
pub fn struct_element_get_actual_text(&self) -> Option<&str>
ADR-019 Tier 2 alias for actual_text().
Corresponds to upstream FPDF_StructElement_GetActualText.
Sourcepub fn get_actual_text(&self) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_actual_text() — matches upstream FPDF_StructElement_GetActualText
pub fn get_actual_text(&self) -> Option<&str>
use struct_element_get_actual_text() — matches upstream FPDF_StructElement_GetActualText
Deprecated short alias — use struct_element_get_actual_text()
or actual_text() instead.
Sourcepub fn title(&self) -> Option<&str>
pub fn title(&self) -> Option<&str>
Returns the title (/T), if present.
Corresponds to upstream FPDF_StructElement_GetTitle.
Sourcepub fn struct_element_get_title(&self) -> Option<&str>
pub fn struct_element_get_title(&self) -> Option<&str>
ADR-019 Tier 2 alias for title().
Corresponds to upstream FPDF_StructElement_GetTitle.
Sourcepub fn get_title(&self) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_title() — matches upstream FPDF_StructElement_GetTitle
pub fn get_title(&self) -> Option<&str>
use struct_element_get_title() — matches upstream FPDF_StructElement_GetTitle
Deprecated short alias — use struct_element_get_title()
or title() instead.
Sourcepub fn id(&self) -> Option<&str>
pub fn id(&self) -> Option<&str>
Returns the element ID (/ID), if present.
Corresponds to upstream FPDF_StructElement_GetID.
Sourcepub fn struct_element_get_id(&self) -> Option<&str>
pub fn struct_element_get_id(&self) -> Option<&str>
ADR-019 Tier 2 alias for id().
Corresponds to upstream FPDF_StructElement_GetID.
Sourcepub fn get_id(&self) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_id() — matches upstream FPDF_StructElement_GetID
pub fn get_id(&self) -> Option<&str>
use struct_element_get_id() — matches upstream FPDF_StructElement_GetID
Deprecated short alias — use struct_element_get_id()
or id() instead.
Sourcepub fn lang(&self) -> Option<&str>
pub fn lang(&self) -> Option<&str>
Returns the language tag (/Lang), if present (e.g., "en-US").
Corresponds to upstream FPDF_StructElement_GetLang.
Sourcepub fn struct_element_get_lang(&self) -> Option<&str>
pub fn struct_element_get_lang(&self) -> Option<&str>
ADR-019 Tier 2 alias for lang().
Corresponds to upstream FPDF_StructElement_GetLang.
Sourcepub fn get_lang(&self) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_lang() — matches upstream FPDF_StructElement_GetLang
pub fn get_lang(&self) -> Option<&str>
use struct_element_get_lang() — matches upstream FPDF_StructElement_GetLang
Deprecated short alias — use struct_element_get_lang()
or lang() instead.
Sourcepub fn string_attribute(&self, attr_name: &str) -> Option<&str>
pub fn string_attribute(&self, attr_name: &str) -> Option<&str>
Look up a named string/name attribute in all attribute dictionaries.
Searches all StructAttribute entries associated with this element for an
entry with attr_name key, and returns the value if it is a
AttributeValue::Text or AttributeValue::Name variant.
Corresponds to upstream FPDF_StructElement_GetStringAttribute.
Sourcepub fn struct_element_get_string_attribute(
&self,
attr_name: &str,
) -> Option<&str>
pub fn struct_element_get_string_attribute( &self, attr_name: &str, ) -> Option<&str>
ADR-019 Tier 2 alias for string_attribute().
Corresponds to upstream FPDF_StructElement_GetStringAttribute.
Sourcepub fn get_string_attribute(&self, attr_name: &str) -> Option<&str>
👎Deprecated since 0.1.0: use struct_element_get_string_attribute() — matches upstream FPDF_StructElement_GetStringAttribute
pub fn get_string_attribute(&self, attr_name: &str) -> Option<&str>
use struct_element_get_string_attribute() — matches upstream FPDF_StructElement_GetStringAttribute
Deprecated short alias — use struct_element_get_string_attribute()
or string_attribute() instead.
Sourcepub fn marked_content_id(&self) -> i64
pub fn marked_content_id(&self) -> i64
Returns the first marked content ID associated with this element, or -1 if none.
For elements with multiple MCIDs, use marked_content_id_count()
and marked_content_id_at_index() to retrieve all of them.
Corresponds to upstream FPDF_StructElement_GetMarkedContentID.
Sourcepub fn struct_element_get_marked_content_id(&self) -> i64
pub fn struct_element_get_marked_content_id(&self) -> i64
ADR-019 Tier 2 alias for marked_content_id().
Corresponds to upstream FPDF_StructElement_GetMarkedContentID.
Sourcepub fn get_marked_content_id(&self) -> i64
👎Deprecated since 0.1.0: use struct_element_get_marked_content_id() — matches upstream FPDF_StructElement_GetMarkedContentID
pub fn get_marked_content_id(&self) -> i64
use struct_element_get_marked_content_id() — matches upstream FPDF_StructElement_GetMarkedContentID
Deprecated short alias — use struct_element_get_marked_content_id()
or marked_content_id() instead.
Sourcepub fn marked_content_id_count(&self) -> i64
pub fn marked_content_id_count(&self) -> i64
Returns the number of marked content IDs associated with this element.
Returns -1 if there are no MCIDs (matching upstream sentinel).
Corresponds to FPDF_StructElement_GetMarkedContentIdCount in PDFium.
Sourcepub fn mcid_count(&self) -> i64
👎Deprecated since 0.1.0: use struct_element_get_marked_content_id_count() or marked_content_id_count() instead
pub fn mcid_count(&self) -> i64
use struct_element_get_marked_content_id_count() or marked_content_id_count() instead
Deprecated: use struct_element_get_marked_content_id_count()
(upstream alias) or marked_content_id_count() (primary) instead.
Sourcepub fn struct_element_get_marked_content_id_count(&self) -> i64
pub fn struct_element_get_marked_content_id_count(&self) -> i64
ADR-019 Tier 2 alias for marked_content_id_count().
Corresponds to FPDF_StructElement_GetMarkedContentIdCount in PDFium.
Sourcepub fn get_marked_content_id_count(&self) -> i64
👎Deprecated since 0.1.0: use struct_element_get_marked_content_id_count() — matches upstream FPDF_StructElement_GetMarkedContentIdCount
pub fn get_marked_content_id_count(&self) -> i64
use struct_element_get_marked_content_id_count() — matches upstream FPDF_StructElement_GetMarkedContentIdCount
Deprecated short alias — use struct_element_get_marked_content_id_count()
or marked_content_id_count() instead.
Sourcepub fn marked_content_id_at_index(&self, index: usize) -> i64
pub fn marked_content_id_at_index(&self, index: usize) -> i64
Returns the marked content ID at a given zero-based index, or -1 if the index
is out of range.
Corresponds to FPDF_StructElement_GetMarkedContentIdAtIndex in PDFium.
Sourcepub fn mcid_at_index(&self, index: usize) -> i64
👎Deprecated since 0.1.0: use struct_element_get_marked_content_id_at_index() or marked_content_id_at_index() instead
pub fn mcid_at_index(&self, index: usize) -> i64
use struct_element_get_marked_content_id_at_index() or marked_content_id_at_index() instead
Deprecated: use struct_element_get_marked_content_id_at_index()
(upstream alias) or marked_content_id_at_index() (primary) instead.
Sourcepub fn struct_element_get_marked_content_id_at_index(&self, index: usize) -> i64
pub fn struct_element_get_marked_content_id_at_index(&self, index: usize) -> i64
ADR-019 Tier 2 alias for marked_content_id_at_index().
Corresponds to FPDF_StructElement_GetMarkedContentIdAtIndex in PDFium.
Sourcepub fn get_marked_content_id_at_index(&self, index: usize) -> i64
👎Deprecated since 0.1.0: use struct_element_get_marked_content_id_at_index() — matches upstream FPDF_StructElement_GetMarkedContentIdAtIndex
pub fn get_marked_content_id_at_index(&self, index: usize) -> i64
use struct_element_get_marked_content_id_at_index() — matches upstream FPDF_StructElement_GetMarkedContentIdAtIndex
Deprecated short alias — use struct_element_get_marked_content_id_at_index()
or marked_content_id_at_index() instead.
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Returns the number of direct children of this element.
Corresponds to upstream FPDF_StructElement_CountChildren.
Sourcepub fn struct_element_count_children(&self) -> usize
pub fn struct_element_count_children(&self) -> usize
ADR-019 Tier 2 alias for child_count().
Corresponds to upstream FPDF_StructElement_CountChildren.
Sourcepub fn count_children(&self) -> usize
👎Deprecated since 0.1.0: use struct_element_count_children() — matches upstream FPDF_StructElement_CountChildren
pub fn count_children(&self) -> usize
use struct_element_count_children() — matches upstream FPDF_StructElement_CountChildren
Deprecated short alias — use struct_element_count_children()
or child_count() instead.
Sourcepub fn child_at_index(&self, index: usize) -> Option<&StructElement>
pub fn child_at_index(&self, index: usize) -> Option<&StructElement>
Returns the child element at a given zero-based index, or None if the index
is out of range.
Corresponds to upstream FPDF_StructElement_GetChildAtIndex.
Sourcepub fn struct_element_get_child_at_index(
&self,
index: usize,
) -> Option<&StructElement>
pub fn struct_element_get_child_at_index( &self, index: usize, ) -> Option<&StructElement>
ADR-019 Tier 2 alias for child_at_index().
Corresponds to upstream FPDF_StructElement_GetChildAtIndex.
Sourcepub fn get_child_at_index(&self, index: usize) -> Option<&StructElement>
👎Deprecated since 0.1.0: use struct_element_get_child_at_index() — matches upstream FPDF_StructElement_GetChildAtIndex
pub fn get_child_at_index(&self, index: usize) -> Option<&StructElement>
use struct_element_get_child_at_index() — matches upstream FPDF_StructElement_GetChildAtIndex
Deprecated short alias — use struct_element_get_child_at_index()
or child_at_index() instead.
Sourcepub fn child_marked_content_id(&self, index: usize) -> i64
pub fn child_marked_content_id(&self, index: usize) -> i64
Returns the marked content ID of a child element at a given zero-based index,
or -1 if the child does not exist or has no MCID.
Corresponds to upstream FPDF_StructElement_GetChildMarkedContentID.
Sourcepub fn struct_element_get_child_marked_content_id(&self, index: usize) -> i64
pub fn struct_element_get_child_marked_content_id(&self, index: usize) -> i64
ADR-019 Tier 2 alias for
child_marked_content_id().
Corresponds to upstream FPDF_StructElement_GetChildMarkedContentID.
Sourcepub fn get_child_marked_content_id(&self, index: usize) -> i64
👎Deprecated since 0.1.0: use struct_element_get_child_marked_content_id() — matches upstream FPDF_StructElement_GetChildMarkedContentID
pub fn get_child_marked_content_id(&self, index: usize) -> i64
use struct_element_get_child_marked_content_id() — matches upstream FPDF_StructElement_GetChildMarkedContentID
Deprecated short alias — use struct_element_get_child_marked_content_id()
or child_marked_content_id() instead.
Sourcepub fn attribute_count(&self) -> usize
pub fn attribute_count(&self) -> usize
Returns the number of attribute dictionaries associated with this element.
Corresponds to upstream FPDF_StructElement_GetAttributeCount.
Sourcepub fn struct_element_get_attribute_count(&self) -> usize
pub fn struct_element_get_attribute_count(&self) -> usize
ADR-019 Tier 2 alias for attribute_count().
Corresponds to upstream FPDF_StructElement_GetAttributeCount.
Sourcepub fn get_attribute_count(&self) -> usize
👎Deprecated since 0.1.0: use struct_element_get_attribute_count() — matches upstream FPDF_StructElement_GetAttributeCount
pub fn get_attribute_count(&self) -> usize
use struct_element_get_attribute_count() — matches upstream FPDF_StructElement_GetAttributeCount
Deprecated short alias — use struct_element_get_attribute_count()
or attribute_count() instead.
Sourcepub fn attribute_at_index(&self, index: usize) -> Option<&StructAttribute>
pub fn attribute_at_index(&self, index: usize) -> Option<&StructAttribute>
Returns the attribute dictionary at a given zero-based index, or None.
Corresponds to upstream FPDF_StructElement_GetAttributeAtIndex.
Sourcepub fn struct_element_get_attribute_at_index(
&self,
index: usize,
) -> Option<&StructAttribute>
pub fn struct_element_get_attribute_at_index( &self, index: usize, ) -> Option<&StructAttribute>
ADR-019 Tier 2 alias for
attribute_at_index().
Corresponds to upstream FPDF_StructElement_GetAttributeAtIndex.
Sourcepub fn get_attribute_at_index(&self, index: usize) -> Option<&StructAttribute>
👎Deprecated since 0.1.0: use struct_element_get_attribute_at_index() — matches upstream FPDF_StructElement_GetAttributeAtIndex
pub fn get_attribute_at_index(&self, index: usize) -> Option<&StructAttribute>
use struct_element_get_attribute_at_index() — matches upstream FPDF_StructElement_GetAttributeAtIndex
Deprecated short alias — use struct_element_get_attribute_at_index()
or attribute_at_index() instead.
Sourcepub fn page_ref(&self) -> Option<ObjectId>
pub fn page_ref(&self) -> Option<ObjectId>
Returns the page object ID reference, if present.
Corresponds to the /Pg entry (used internally by structure tree page filtering).
Sourcepub fn parent_index(&self) -> Option<usize>
pub fn parent_index(&self) -> Option<usize>
Returns the zero-based index of this element within its parent’s children list,
or None if this element is a root element (a direct child of StructTree).
Use this together with the parent StructElement to navigate upward in the tree.
Root elements return None — they have no parent.
Corresponds to upstream FPDF_StructElement_GetParent.
Sourcepub fn struct_element_get_parent(&self) -> Option<usize>
pub fn struct_element_get_parent(&self) -> Option<usize>
ADR-019 Tier 2 alias for parent_index().
Returns the zero-based index of this element within its parent’s children
list, or None for root elements.
Note: the rpdfium tree model stores elements by value, so this returns an index rather than a handle. Use this index together with the parent node to navigate upward in the tree.
Corresponds to upstream FPDF_StructElement_GetParent.
Sourcepub fn get_parent(&self) -> Option<usize>
👎Deprecated since 0.1.0: use struct_element_get_parent() — matches upstream FPDF_StructElement_GetParent
pub fn get_parent(&self) -> Option<usize>
use struct_element_get_parent() — matches upstream FPDF_StructElement_GetParent
Deprecated short alias — use struct_element_get_parent()
or parent_index() instead.
Sourcepub fn get_parent_index(&self) -> Option<usize>
👎Deprecated since 0.1.0: use struct_element_get_parent() or parent_index() instead
pub fn get_parent_index(&self) -> Option<usize>
use struct_element_get_parent() or parent_index() instead
Deprecated: use struct_element_get_parent() (upstream alias) or
parent_index() (primary) instead.
Trait Implementations§
Source§impl Clone for StructElement
impl Clone for StructElement
Source§fn clone(&self) -> StructElement
fn clone(&self) -> StructElement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more