Skip to main content

TreeKind

Enum TreeKind 

Source
pub enum TreeKind {
    Text {
        label: String,
        text: String,
        orig: Option<String>,
        formatting: Option<Formatting>,
        hyperlink: Option<String>,
        level: Option<u8>,
        list: Option<ListMeta>,
    },
    Code {
        text: String,
        orig: Option<String>,
        language: Option<String>,
        formatting: Option<Formatting>,
        hyperlink: Option<String>,
    },
    Group {
        label: String,
        name: String,
    },
    Table {
        table: Table,
        rich_cells: Vec<(usize, usize, usize)>,
        captions: Vec<usize>,
    },
    Picture {
        captions: Vec<usize>,
        image: Option<PictureImage>,
        classification: Option<String>,
        confidence: Option<f64>,
        chart: Option<Table>,
        dpi: Option<u32>,
    },
    FieldRegion {
        items: Vec<FieldItem>,
    },
}
Expand description

What an item in the tree is. Mirrors the docling-core item classes the JSON texts / groups / tables / pictures / field_regions buckets hold.

Variants§

§

Text

A TextItem / TitleItem / SectionHeaderItem / ListItem, told apart by label (text, title, section_header, list_item, caption, checkbox_selected, checkbox_unselected, …).

Fields

§label: String
§text: String
§orig: Option<String>

docling’s orig when it differs from text (the heading text before unicode cleanup, say); None = same as text.

§formatting: Option<Formatting>
§hyperlink: Option<String>
§level: Option<u8>

section_header only: docling’s heading level.

§list: Option<ListMeta>

list_item only.

§

Code

A CodeItem.

Fields

§text: String
§language: Option<String>

The language hint (a highlighter class token such as python), mapped onto docling’s CodeLanguageLabel at export; Noneunknown.

§formatting: Option<Formatting>
§hyperlink: Option<String>
§

Group

A GroupItem: label is docling’s GroupLabel value (inline, list, section, unspecified, …), name its name (group, list, ordered list, header-2, rich_cell_group_1_0_3, …).

Fields

§label: String
§name: String
§

Table

A TableItem. rich_cells marks the cells docling serialized as a RichTableCell: (row, col) grid anchor → the group item (a child of the table) that holds the cell’s content. captions are caption text items in the tree.

Fields

§table: Table
§rich_cells: Vec<(usize, usize, usize)>
§captions: Vec<usize>
§

Picture

A PictureItem, its caption text items and optional payload. classification is a PictureClassificationLabel value written as the picture’s meta.classification (an HTML <stamp> / <signature>).

Fields

§captions: Vec<usize>
§classification: Option<String>
§confidence: Option<f64>

The prediction’s confidence, when the backend writes one: the DocLang deserializer stamps 1.0; the office and HTML backends leave it out (None).

§chart: Option<Table>

A native chart’s data grid (docling’s meta.tabular_chart.chart_data, the series reconstructed as a TableData), for a DOCX chart drawing.

§dpi: Option<u32>

The ImageRef.dpi docling writes for image when the backend read one from the file (python-pptx’s Image.dpi: PIL’s dpi info, rounded, 72 when absent or out of 1–2048); None → 72, which is what upstream’s other office backends pass.

§

FieldRegion

A form key-value region (field_regions / field_items).

Fields

Trait Implementations§

Source§

impl Clone for TreeKind

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 TreeKind

Source§

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

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

impl PartialEq for TreeKind

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 TreeKind

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.