pub struct LayoutElement {
pub bbox: BoundingBox,
pub element_type: LayoutElementType,
pub confidence: f32,
pub label: Option<String>,
pub text: Option<String>,
pub order_index: Option<u32>,
pub seg_start_x: Option<f32>,
pub seg_end_x: Option<f32>,
pub num_lines: Option<u32>,
}Expand description
A layout element detected in the document.
Fields§
§bbox: BoundingBoxBounding box of the element
element_type: LayoutElementTypeType of the layout element
confidence: f32Confidence score for the detection
label: Option<String>Optional label for the element (original model label)
text: Option<String>Optional text content for the element
order_index: Option<u32>Reading order index (1-based, assigned during stitching)
This index represents the element’s position in the reading order.
Only elements that should be included in reading flow (text, tables,
formulas, images, etc.) will have an order index assigned.
Headers, footers, and other auxiliary elements may have None.
seg_start_x: Option<f32>X-coordinate of the first text span’s left edge within this element.
Used by get_seg_flag to detect paragraph continuity across blocks.
Computed during stitching from the first OCR region (after spatial sort).
seg_end_x: Option<f32>X-coordinate of the last text span’s right edge within this element.
Used by get_seg_flag to detect paragraph continuity across blocks.
Computed during stitching from the last OCR region (after spatial sort).
num_lines: Option<u32>Number of text lines within this element.
Used by get_seg_flag to detect paragraph continuity across blocks.
Implementations§
Source§impl LayoutElement
impl LayoutElement
Sourcepub fn new(
bbox: BoundingBox,
element_type: LayoutElementType,
confidence: f32,
) -> Self
pub fn new( bbox: BoundingBox, element_type: LayoutElementType, confidence: f32, ) -> Self
Creates a new layout element.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Sets the label for the element.
Trait Implementations§
Source§impl Clone for LayoutElement
impl Clone for LayoutElement
Source§fn clone(&self) -> LayoutElement
fn clone(&self) -> LayoutElement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LayoutElement
impl Debug for LayoutElement
Source§impl<'de> Deserialize<'de> for LayoutElement
impl<'de> Deserialize<'de> for LayoutElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for LayoutElement
impl RefUnwindSafe for LayoutElement
impl Send for LayoutElement
impl Sync for LayoutElement
impl Unpin for LayoutElement
impl UnsafeUnpin for LayoutElement
impl UnwindSafe for LayoutElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.