CalculatedLayout

Struct CalculatedLayout 

Source
pub struct CalculatedLayout { /* private fields */ }
Expand description

A helper for working with a single calculated layout.

This provides convenient methods for accessing and working with layout rects.

Implementations§

Source§

impl CalculatedLayout

Source

pub fn new(rects: Vec<Vec<Rect>>) -> Self

Creates a new CalculatedLayout from calculated rects.

Source

pub fn get(&self, row: usize, col: usize) -> Option<&Rect>

Gets a rect at the specified row and column.

Source

pub fn row(&self, row: usize) -> Option<&[Rect]>

Gets all rects in a row.

Source

pub fn row_count(&self) -> usize

Returns the total number of rows.

Source

pub fn col_count(&self, row: usize) -> usize

Returns the number of columns in a specific row.

Source

pub fn iter(&self) -> impl Iterator<Item = (usize, usize, &Rect)>

Iterates over all rects with their row and column indices.

Source

pub fn render_at<R: Render>( &self, row: usize, col: usize, element: R, buffer: &mut Buffer, ) -> Option<Vec2>

Renders an element at a specific layout position.

Source

pub fn render_clipped_at<R: Render>( &self, row: usize, col: usize, element: R, buffer: &mut Buffer, ) -> Option<Vec2>

Renders an element clipped to a specific layout position.

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> 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.