Skip to main content

RenderGrid

Struct RenderGrid 

Source
pub struct RenderGrid {
    pub cells: Vec<Vec<Cell>>,
    pub width: u32,
    pub height: u32,
}
Expand description

A 2D grid of Cells with explicit width × height dimensions.

Filters operate on owned RenderGrids and return new owned grids per AD-002 (immutable transformations). Construction normalizes ragged row vectors to a rectangular shape padded with Cell::blank so downstream filters can assume cells[y].len() == width for every row.

Allocated as Vec<Vec<Cell>> rather than a single flat Vec<Cell> because the filter implementations (transpose, rotate, flip) work row-major and benefit from being able to .swap(), .reverse(), and .collect() per-row without index arithmetic.

Fields§

§cells: Vec<Vec<Cell>>

Cells in row-major order. cells[y][x] is the cell at column x, row y. Every row is exactly width cells long after construction.

§width: u32

Number of columns.

§height: u32

Number of rows.

Implementations§

Source§

impl RenderGrid

Source

pub fn empty() -> Self

Construct an empty grid (0×0).

Source

pub fn blank(width: u32, height: u32) -> Self

Construct a rectangular grid sized width × height, filled with blank cells.

Source

pub fn from_rows(rows: Vec<Vec<Cell>>) -> Self

Build a grid from a vector of rows; ragged rows are padded with Cell::blank up to the longest row’s length.

Source

pub fn from_text_rows(rows: &[String]) -> Self

Construct a grid from a multi-line &str. Each line is one row; each character is one cell with default color. Convenient for tests and the FLF/TLF render pipeline’s Vec<String> row output.

Trait Implementations§

Source§

impl Clone for RenderGrid

Source§

fn clone(&self) -> RenderGrid

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderGrid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RenderGrid

Source§

impl PartialEq for RenderGrid

Source§

fn eq(&self, other: &RenderGrid) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RenderGrid

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.