Skip to main content

Placement

Struct Placement 

Source
pub struct Placement {
    pub page_number: u32,
    pub bounding_box: BoundingBox,
    pub line_number: u32,
    pub segment_number: u32,
    pub rotation: i32,
    pub paragraph_number: u32,
    pub region_label: Option<String>,
    pub page_width: f32,
    pub page_height: f32,
}
Expand description

Spatial and structural metadata about where a text element lives in its source. Populated for PDF-sourced elements. Future HTML/Markdown preprocessors may produce elements with placement: None.

Fields§

§page_number: u32

1-indexed page number on the source PDF.

§bounding_box: BoundingBox

Bounding box on the PDF page.

§line_number: u32

0-indexed line number within the paragraph. From data-line on span.

§segment_number: u32

0-indexed segment number within the line. From data-segment on span.

§rotation: i32

Text rotation in degrees: 0, 90, 180, 270. Non-zero when inside <aside data-rotation="N"> (CR-10).

§paragraph_number: u32

Tika’s paragraph number within the page (per-page counter, reset each page). This is a Y-gap heuristic — reliable for clean prose, less so for math/list content.

§region_label: Option<String>

Region tree leaf label this element belongs to. Set by Block 06b (analytics::reading_order::tag_and_resort) when the analytics pre-pass runs. Values:

  • Some("1"), Some("2-1"), etc. — body element in the named Region tree leaf (depth-first reading-order path from RegionStats.per_page[…].root).
  • Some("H-1"), Some("H-2"), … — header element (y-asc within the page’s headers above geometry.header_y).
  • Some("F-1"), Some("F-2"), … — footer element (y-asc within the page’s footers below geometry.doc_footer_y).
  • None — orphan element (within body Y range but outside the body X range — marginalia, sidebar). Placed at the end of the page’s reading order in original Tika sequence.

Internal pipeline state — not a public schema field. Optional via #[serde(default)] so caches that predate this field deserialize cleanly with region_label = None.

§page_width: f32

Width of the source PDF page in points. Sourced from Tika’s <div class="page-meta" data-width=…> (added by Tika as part of the layout-reasoning consolidation flow). Carried on every element so analytics can size per-page heatmaps without a per-page side-channel. #[serde(default)] keeps c2-preprocessor caches written before this field existed deserializable; the value is 0.0 in that case and consumers should treat 0.0 as “unknown”.

§page_height: f32

Height of the source PDF page in points. See page_width.

Trait Implementations§

Source§

impl Clone for Placement

Source§

fn clone(&self) -> Placement

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 Placement

Source§

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

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

impl<'de> Deserialize<'de> for Placement

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Placement, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Placement

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.