Skip to main content

StructureTree

Struct StructureTree 

Source
pub struct StructureTree { /* private fields */ }
Expand description

The document’s structure tree root (/StructTreeRoot), loaded once per document and asked per page where that page’s marked content sits in the tree. /MarkInfo is never consulted: a tree with leaves counts, whatever the file says about itself.

Implementations§

Source§

impl StructureTree

Source

pub async fn load_with<S: AsyncObjectSource>( src: &S, trailer: &Dict, ) -> Option<StructureTree>

Loads the catalog’s /StructTreeRoot, or None when the document declares none, or when the entry is missing or unreadable, which leaves every page in content order.

Covers ISO 32000-1 §14.7.2.

Source

pub fn mapped_type(&self, name: &str) -> String

name followed through the root’s /RoleMap until a name the map has no entry for. The map is meant to reach a standard structure type (§14.8.4) in one step; a chain is followed in case a mapped name is itself mapped, and a cycle leaves the name as written.

Covers ISO 32000-1 §14.7.3.

Source

pub async fn ranks_with<S: AsyncObjectSource>( &self, src: &S, page: &Page, ids: &[MarkedContentId], ) -> FastMap<MarkedContentId, u32>

The ranks of StructureTree::place_with alone: one page’s marked-content sequences by their position in the tree’s depth-first order, 0 for the first the tree reaches.

Covers ISO 32000-1 §14.8.2 and §14.8.2.3.

Source

pub async fn place_with<S: AsyncObjectSource>( &self, src: &S, page: &Page, ids: &[MarkedContentId], ) -> FastMap<MarkedContentId, Placement>

Places ids, one page’s marked-content sequences, in the tree: each gets its rank in the tree’s depth-first order (0 for the first the tree reaches, and so on) and the structure type of the element holding it. An id the tree never reaches (untagged content, a key the parent tree lacks, an element whose ancestry is broken) is absent, so an empty map means the page has no leaves in the tree.

The lookup goes through the parent tree (/ParentTree, keyed by /StructParents) and each element’s /P chain, so it costs the page’s own elements, never a walk of the whole tree.

Covers ISO 32000-1 §14.7.3, §14.8.2 and §14.8.2.3.

Trait Implementations§

Source§

impl Clone for StructureTree

Source§

fn clone(&self) -> StructureTree

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 StructureTree

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for StructureTree

Source§

fn eq(&self, other: &StructureTree) -> 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 StructureTree

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.