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
impl StructureTree
Sourcepub async fn load_with<S: AsyncObjectSource>(
src: &S,
trailer: &Dict,
) -> Option<StructureTree>
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.
Sourcepub fn mapped_type(&self, name: &str) -> String
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.
Sourcepub async fn ranks_with<S: AsyncObjectSource>(
&self,
src: &S,
page: &Page,
ids: &[MarkedContentId],
) -> FastMap<MarkedContentId, u32>
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.
Sourcepub async fn place_with<S: AsyncObjectSource>(
&self,
src: &S,
page: &Page,
ids: &[MarkedContentId],
) -> FastMap<MarkedContentId, Placement>
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
impl Clone for StructureTree
Source§fn clone(&self) -> StructureTree
fn clone(&self) -> StructureTree
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more