Skip to main content

TreeItem

Struct TreeItem 

Source
pub struct TreeItem {
Show 16 fields pub parent: Option<usize>, pub children: Vec<usize>, pub layer: Option<ContentLayer>, pub kind: TreeKind, pub prov: Option<TreeProv>, pub comments: Vec<usize>, pub source: Option<TreeTrack>, pub deleted: bool, pub footnotes: Vec<usize>, pub notes: Vec<TreeNote>, pub note_body: bool, pub anchors: Vec<String>, pub number: Option<String>, pub revision: Option<Revision>, pub code_meta: Option<(String, String)>, pub block: Option<usize>,
}
Expand description

One item of an ItemTree.

Fields§

§parent: Option<usize>

The parent item’s index; None = the document body.

§children: Vec<usize>

Child item indices, in docling’s children order.

§layer: Option<ContentLayer>

The content layer; None = body.

§kind: TreeKind§prov: Option<TreeProv>

The item’s prov entry, when the backend has page geometry for it (None → prov: [], what the HTML and DOCX backends write).

§comments: Vec<usize>

docling’s DocItem.comments: the comment_section groups (or note text items) annotating this item, as item indices — written after prov when non-empty.

§source: Option<TreeTrack>

docling’s DocItem.source: the track segment a text item was taken from (WebVTT cues) — written after prov when set.

§deleted: bool

Removed by ItemTree::delete (docling’s delete_items): the slot stays so every other index keeps its meaning, but the item is not numbered or written.

§footnotes: Vec<usize>

docling’s FloatingItem.footnotes for a picture or code item (a DocLang float group’s <footnote>s), as item indices — written as the item’s footnotes refs; a table keeps its own in TreeKind::Table’s footnotes. Unrelated to Self::notes, which are note calls in a text.

§notes: Vec<TreeNote>

Footnotes / endnotes referenced from inside this text item (#538): the note call’s position (chars into the item’s text) and the note’s text. docling keeps notes as unlinked furniture footnote items, so the JSON never shows this; the Pandoc AST writes each as a Note there.

§note_body: bool

This furniture footnote item is the body of a note some text item calls (it travels in that item’s Self::notes); the Pandoc AST then leaves it out as a standalone block.

§anchors: Vec<String>

Link destinations at this item (#849): the identifiers a document’s internal links (hyperlink: "#id") point at — a DOCX bookmark in a heading, say. docling’s model has no slot for them, so the JSON shows them only on the Pandoc path (_anchors), where a heading’s first one is its Header id and the rest empty Span .anchors.

§number: Option<String>

The generated numbering text opens with, when the backend put one there (#850: a DOCX heading numbered through w:numPr is docling’s 1.2 Title): "1.2" — the authored text follows it after one space. docling’s JSON keeps the numbered text; the Pandoc AST writes the authored text alone (_number on that path), since Pandoc numbers sections itself (--number-sections) and its docx reader never writes the number into the Header.

§revision: Option<Revision>

The tracked change this run carries under TrackChanges::All (#851): the Pandoc AST wraps the run in Span .insertion / .deletion (_revision on that path); docling’s JSON has no field for it.

§code_meta: Option<(String, String)>

A picture’s meta.code — docling’s CodeMetaField (text, language): the LaTeX backend keeps a tikzpicture’s source there when no engine renders it (("…", "Tikz")).

§block: Option<usize>

The source block this item was made from (#903): an index into ItemTree::blocks, set by a backend that enumerates its source’s blocks (HTML). None when the backend does not, or for an item no single block produced.

Trait Implementations§

Source§

impl Clone for TreeItem

Source§

fn clone(&self) -> Self

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 TreeItem

Source§

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

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

impl PartialEq for TreeItem

Source§

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

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

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.