Skip to main content

StructType

Enum StructType 

Source
pub enum StructType {
Show 37 variants Document, Part, Art, Sect, Div, P, H, H1, H2, H3, H4, H5, H6, L, LI, Lbl, LBody, Table, TR, TH, TD, THead, TBody, TFoot, Span, Quote, Note, Reference, BibEntry, Code, Link, Annot, WB, Figure, Formula, Form, Custom(String),
}
Expand description

Standard structure types from PDF spec Section 14.8.4.

These are the standard structure types defined by the PDF specification. Custom types can be mapped to standard types via the RoleMap.

Variants§

§

Document

Document root

§

Part

Part (major division)

§

Art

Article

§

Sect

Section

§

Div

Division

§

P

Paragraph

§

H

Heading level 1-6

§

H1

Heading level 1

§

H2

Heading level 2

§

H3

Heading level 3

§

H4

Heading level 4

§

H5

Heading level 5

§

H6

Heading level 6

§

L

List

§

LI

List item

§

Lbl

Label (list item marker)

§

LBody

List body (list item content)

§

Table

Table

§

TR

Table row

§

TH

Table header cell

§

TD

Table data cell

§

THead

Table header group

§

TBody

Table body group

§

TFoot

Table footer group

§

Span

Span (inline generic)

§

Quote

Quote

§

Note

Note

§

Reference

Reference

§

BibEntry

Bibliographic entry

§

Code

Code

Link

§

Annot

Annotation

§

WB

Word break - explicit word boundary in structure tree (PDF 1.5+)

Per PDF spec Section 14.8.4.4, WB elements mark word boundaries in languages that do not use spaces between words (e.g., CJK).

§

Figure

Figure

§

Formula

Formula

§

Form

Form (input field)

§

Custom(String)

Custom structure type not defined in the PDF specification

Implementations§

Source§

impl StructType

Source

pub fn from_str(s: &str) -> Self

Parse structure type from string (e.g., “/P” -> StructType::P)

Source

pub fn is_heading(&self) -> bool

Check if this is a heading type (H, H1-H6)

Source

pub fn is_block(&self) -> bool

Check if this is a block-level element

Source

pub fn heading_level(&self) -> Option<u8>

Get heading level (1-6) if this is a heading type

Source

pub fn is_list(&self) -> bool

Check if this is a list type (L, LI, Lbl, LBody)

Source

pub fn is_word_break(&self) -> bool

Check if this is a word break element (WB)

Word break elements mark explicit word boundaries in languages that don’t use spaces (e.g., CJK). When encountered during text extraction, a space should be inserted.

Source

pub fn markdown_prefix(&self) -> Option<&'static str>

Get markdown prefix for this structure type

Trait Implementations§

Source§

impl Clone for StructType

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 StructType

Source§

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

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

impl Eq for StructType

Source§

impl PartialEq for StructType

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 StructType

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more