Skip to main content

StructElement

Struct StructElement 

Source
pub struct StructElement {
    pub dict: Dict,
    pub reference: Option<ObjRef>,
    pub kind: Vec<u8>,
    pub kids: Vec<Kid>,
    pub parent: Option<usize>,
}
Expand description

A logical structure element.

Fields§

§dict: Dict

The element’s own dictionary.

§reference: Option<ObjRef>

Its object reference, when it is indirect.

§kind: Vec<u8>

/S after the role map has been applied once, at load time. The raw /S is not retained.

§kids: Vec<Kid>

The kid slots, in /K order.

§parent: Option<usize>

The parent element’s index in the tree’s element table, once the bottom-up walk has linked it.

Implementations§

Source§

impl StructElement

Source

pub fn load_kids<R: Resolve>(dict: &Dict, page_obj_num: u32, r: &R) -> Vec<Kid>

Reads an element’s kids against a page.

page_obj_num is the page being read; content kids that name a different page become Kid::Invalid, while element kids are never page-tested at all — that asymmetry is what lets one element tree be reachable from every page it touches.

Points a kid slot at an element the walk has now built.

Answers whether any slot matched — a question, not a refused mutation. Matching is by object reference when both sides have one, and by dictionary equality otherwise, which is how an inline kid dictionary — having no object number to compare — still finds its slot.

Source

pub fn obj_type<R: Resolve>(&self, r: &R) -> Vec<u8> ⓘ

/Type, coerced from whatever the key holds. Usually StructElem.

Source

pub fn alt_text<R: Resolve>(&self, r: &R) -> String

/Alt, the alternate description.

Source

pub fn actual_text<R: Resolve>(&self, r: &R) -> String

/ActualText, the exact replacement text.

Source

pub fn expansion<R: Resolve>(&self, r: &R) -> String

/E, an abbreviation’s expansion.

Source

pub fn title<R: Resolve>(&self, r: &R) -> String

/T, the element’s title.

Source

pub fn id(&self) -> Option<Vec<u8>>

/ID, read without resolving and filtered to a string.

The Option is load-bearing: a present-but-empty /ID differs from an absent one at the API boundary, even though the dump prints neither.

Source

pub fn lang(&self) -> Option<Vec<u8>>

/Lang, read without resolving and filtered to a string.

Not inherited — a row inside a table with /Lang /hu reports nothing of its own.

Source

pub fn kid_content_id(&self, index: usize) -> Option<i64>

The /MCID a kid names, or None for a kid that is not content.

This is the page-filtered reading: a content kid belonging to another page came in as Kid::Invalid and answers None here. The dump uses a different, unfiltered accessor (marked_content_id_count).

A real /MCID is non-negative (ISO 32000-1 §14.7.4.2), so a Some is always a value the file carries.

Trait Implementations§

Source§

impl Clone for StructElement

Source§

fn clone(&self) -> StructElement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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
Source§

impl PartialEq for StructElement

Source§

fn eq(&self, other: &StructElement) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StructElement

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, 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.