Skip to main content

TextElement

Struct TextElement 

Source
pub struct TextElement<'a> { /* private fields */ }
Expand description

Text element.

A layout element with the recognized text.

Implementations§

Source§

impl<'a> TextElement<'a>

Source

pub fn get_utf8_text(&self, level: LayoutLevel) -> Utf8Text

Get recognized text as UTF-8 string.

Source

pub fn confidence(&self, level: LayoutLevel) -> f32

Returns the mean confidence of the element at the given level.

The confidence range is [0; 100].

Source

pub fn word_recognition_language(&self) -> Option<&CStr>

Returns the language that was used to recognize the word.

Source

pub fn word_is_from_dictionary(&self) -> bool

Returns true if the current word is a dictionary word.

Source

pub fn word_is_numeric(&self) -> bool

Returns true if the current word is a number.

Source

pub fn word_font_attributes(&self) -> Option<(FontAttrs, &CStr)>

Returns font attributes of the current word as well as the font name.

Source

pub fn symbol_is_superscript(&self) -> bool

Returns true if the current symbol is a superscript.

Source

pub fn symbol_is_subscript(&self) -> bool

Returns true if the current symbol is a subscript.

Source

pub fn symbol_is_dropcap(&self) -> bool

Returns true if the current symbol is a dropcap.

Source

pub fn choices(&self) -> ChoiceIterator<'a>

Returns an iteratove over classifier choices for the current symbol.

Methods from Deref<Target = Element<'a>>§

Source

pub fn is_at_beginning_of(&self, level: LayoutLevel) -> bool

Returns true if the element is at the start of the given level.

Source

pub fn is_at_final_element( &self, level: LayoutLevel, element: LayoutLevel, ) -> bool

Returns true if the element is at the end of the given level.

Source

pub fn bounding_box(&self, level: LayoutLevel) -> Option<Rectangle>

Returns the bounds of the element at the given level of the layout.

Returns None if the given level doesn’t exist.

The box position and dimensions should match the ones of get_binary_image but may not match the ones of get_image due to padding.

Source

pub fn block_type(&self) -> BlockType

Returns block type.

Source

pub fn get_binary_image(&self, level: LayoutLevel) -> Image

Returns a binary image of the element at the given layout level.

Source

pub fn get_image( &self, level: LayoutLevel, padding: u32, original: &Image, ) -> (Image, i32, i32)

Returns a grayscale image of the element at the given layout level.

Padding is added to the left-top corner in both dimensions.

If padding is zero, then the returned positions and dimensions should match the ones of bounding_box.

Source

pub fn baseline(&self, level: LayoutLevel) -> Option<Line>

Returns the baseline of the element.

Source

pub fn orientation(&self) -> OrientationParams

Returns the element’s block orientation.

Source

pub fn paragraph_info(&self) -> ParagraphInfo

Returns the element’s paragraph information.

Trait Implementations§

Source§

impl<'a> Deref for TextElement<'a>

Source§

type Target = Element<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for TextElement<'a>

§

impl<'a> RefUnwindSafe for TextElement<'a>

§

impl<'a> !Send for TextElement<'a>

§

impl<'a> !Sync for TextElement<'a>

§

impl<'a> Unpin for TextElement<'a>

§

impl<'a> UnsafeUnpin for TextElement<'a>

§

impl<'a> UnwindSafe for TextElement<'a>

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.