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>,
}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.
Implementations§
Source§impl LayoutElement
impl LayoutElement
Sourcepub fn new(
bbox: BoundingBox,
element_type: LayoutElementType,
confidence: f32,
) -> LayoutElement
pub fn new( bbox: BoundingBox, element_type: LayoutElementType, confidence: f32, ) -> LayoutElement
Creates a new layout element.
Sourcepub fn with_label(self, label: impl Into<String>) -> LayoutElement
pub fn with_label(self, label: impl Into<String>) -> LayoutElement
Sets the label for the element.
Sourcepub fn with_text(self, text: impl Into<String>) -> LayoutElement
pub fn with_text(self, text: impl Into<String>) -> LayoutElement
Sets the text content for the element.
Trait Implementations§
Source§impl Clone for LayoutElement
impl Clone for LayoutElement
Source§fn clone(&self) -> LayoutElement
fn clone(&self) -> LayoutElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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<LayoutElement, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutElement, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for LayoutElement
impl Serialize for LayoutElement
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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§
impl Freeze for LayoutElement
impl RefUnwindSafe for LayoutElement
impl Send for LayoutElement
impl Sync for LayoutElement
impl Unpin 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.