Skip to main content

Element

Struct Element 

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

Text layout element.

Implementations§

Source§

impl Element<'_>

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.

Auto Trait Implementations§

§

impl<'a> Freeze for Element<'a>

§

impl<'a> RefUnwindSafe for Element<'a>

§

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

§

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

§

impl<'a> Unpin for Element<'a>

§

impl<'a> UnsafeUnpin for Element<'a>

§

impl<'a> UnwindSafe for Element<'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<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.