Skip to main content

StructElement

Struct StructElement 

Source
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: String

Structure 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

Source

pub fn struct_type(&self) -> &str

Returns the structure type tag (e.g., “Document”, “P”, “H1”, “Table”, “Figure”).

Corresponds to upstream FPDF_StructElement_GetType.

Source

pub fn struct_element_get_type(&self) -> &str

ADR-019 Tier 2 alias for struct_type().

Corresponds to upstream FPDF_StructElement_GetType.

Source

pub fn get_type(&self) -> &str

👎Deprecated since 0.1.0:

use struct_element_get_type() — matches upstream FPDF_StructElement_GetType

Deprecated short alias — use struct_element_get_type() or struct_type() instead.

Source

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.

Source

pub fn struct_element_get_obj_type(&self) -> Option<&str>

ADR-019 Tier 2 alias for obj_type().

Corresponds to upstream FPDF_StructElement_GetObjType.

Source

pub fn get_obj_type(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_get_obj_type() — matches upstream FPDF_StructElement_GetObjType

Deprecated short alias — use struct_element_get_obj_type() or obj_type() instead.

Source

pub fn alt_text(&self) -> Option<&str>

Returns the alternative text (/Alt), if present.

Corresponds to upstream FPDF_StructElement_GetAltText.

Source

pub fn struct_element_get_alt_text(&self) -> Option<&str>

ADR-019 Tier 2 alias for alt_text().

Corresponds to upstream FPDF_StructElement_GetAltText.

Source

pub fn get_alt_text(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_get_alt_text() — matches upstream FPDF_StructElement_GetAltText

Deprecated short alias — use struct_element_get_alt_text() or alt_text() instead.

Source

pub fn actual_text(&self) -> Option<&str>

Returns the actual text (/ActualText), if present.

Corresponds to upstream FPDF_StructElement_GetActualText.

Source

pub fn struct_element_get_actual_text(&self) -> Option<&str>

ADR-019 Tier 2 alias for actual_text().

Corresponds to upstream FPDF_StructElement_GetActualText.

Source

pub fn get_actual_text(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_get_actual_text() — matches upstream FPDF_StructElement_GetActualText

Deprecated short alias — use struct_element_get_actual_text() or actual_text() instead.

Source

pub fn title(&self) -> Option<&str>

Returns the title (/T), if present.

Corresponds to upstream FPDF_StructElement_GetTitle.

Source

pub fn struct_element_get_title(&self) -> Option<&str>

ADR-019 Tier 2 alias for title().

Corresponds to upstream FPDF_StructElement_GetTitle.

Source

pub fn get_title(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_get_title() — matches upstream FPDF_StructElement_GetTitle

Deprecated short alias — use struct_element_get_title() or title() instead.

Source

pub fn id(&self) -> Option<&str>

Returns the element ID (/ID), if present.

Corresponds to upstream FPDF_StructElement_GetID.

Source

pub fn struct_element_get_id(&self) -> Option<&str>

ADR-019 Tier 2 alias for id().

Corresponds to upstream FPDF_StructElement_GetID.

Source

pub fn get_id(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_get_id() — matches upstream FPDF_StructElement_GetID

Deprecated short alias — use struct_element_get_id() or id() instead.

Source

pub fn lang(&self) -> Option<&str>

Returns the language tag (/Lang), if present (e.g., "en-US").

Corresponds to upstream FPDF_StructElement_GetLang.

Source

pub fn struct_element_get_lang(&self) -> Option<&str>

ADR-019 Tier 2 alias for lang().

Corresponds to upstream FPDF_StructElement_GetLang.

Source

pub fn get_lang(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_get_lang() — matches upstream FPDF_StructElement_GetLang

Deprecated short alias — use struct_element_get_lang() or lang() instead.

Source

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.

Source

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.

Source

pub 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

Deprecated short alias — use struct_element_get_string_attribute() or string_attribute() instead.

Source

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.

Source

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.

Source

pub fn get_marked_content_id(&self) -> i64

👎Deprecated since 0.1.0:

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.

Source

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.

Source

pub fn mcid_count(&self) -> i64

👎Deprecated since 0.1.0:

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.

Source

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.

Source

pub 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

Source

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.

Source

pub 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

Deprecated: use struct_element_get_marked_content_id_at_index() (upstream alias) or marked_content_id_at_index() (primary) instead.

Source

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.

Source

pub 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

Source

pub fn child_count(&self) -> usize

Returns the number of direct children of this element.

Corresponds to upstream FPDF_StructElement_CountChildren.

Source

pub fn struct_element_count_children(&self) -> usize

ADR-019 Tier 2 alias for child_count().

Corresponds to upstream FPDF_StructElement_CountChildren.

Source

pub fn count_children(&self) -> usize

👎Deprecated since 0.1.0:

use struct_element_count_children() — matches upstream FPDF_StructElement_CountChildren

Deprecated short alias — use struct_element_count_children() or child_count() instead.

Source

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.

Source

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.

Source

pub 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

Deprecated short alias — use struct_element_get_child_at_index() or child_at_index() instead.

Source

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.

Source

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.

Source

pub 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

Source

pub fn attribute_count(&self) -> usize

Returns the number of attribute dictionaries associated with this element.

Corresponds to upstream FPDF_StructElement_GetAttributeCount.

Source

pub fn struct_element_get_attribute_count(&self) -> usize

ADR-019 Tier 2 alias for attribute_count().

Corresponds to upstream FPDF_StructElement_GetAttributeCount.

Source

pub fn get_attribute_count(&self) -> usize

👎Deprecated since 0.1.0:

use struct_element_get_attribute_count() — matches upstream FPDF_StructElement_GetAttributeCount

Deprecated short alias — use struct_element_get_attribute_count() or attribute_count() instead.

Source

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.

Source

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.

Source

pub 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

Deprecated short alias — use struct_element_get_attribute_at_index() or attribute_at_index() instead.

Source

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).

Source

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.

Source

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.

Source

pub fn get_parent(&self) -> Option<usize>

👎Deprecated since 0.1.0:

use struct_element_get_parent() — matches upstream FPDF_StructElement_GetParent

Deprecated short alias — use struct_element_get_parent() or parent_index() instead.

Source

pub fn get_parent_index(&self) -> Option<usize>

👎Deprecated since 0.1.0:

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

Source§

fn clone(&self) -> StructElement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructElement

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more