pub struct TerminalCellGrid { /* private fields */ }Expand description
Dense cols x rows character cell surface for deterministic terminal TUI and CLI rendering.
Implementations§
Source§impl TerminalCellGrid
Grid allocation, wide-char-safe writing, box drawing, and plain-text serialization for TerminalCellGrid.
impl TerminalCellGrid
Grid allocation, wide-char-safe writing, box drawing, and plain-text serialization for TerminalCellGrid.
Sourcepub fn reset(&mut self, cols: u16, rows: u16)
pub fn reset(&mut self, cols: u16, rows: u16)
Resizes and clears the grid to cols x rows, reusing existing capacity when unchanged.
§Arguments
&Self- Mutable grid.u16- Target column count.u16- Target row count.
Sourcepub fn total_cells(&self) -> usize
pub fn total_cells(&self) -> usize
Sourcepub fn put_cell(&mut self, col: u16, row: u16, cell: TerminalCell) -> u16
pub fn put_cell(&mut self, col: u16, row: u16, cell: TerminalCell) -> u16
Writes a single narrow or wide TerminalCell at (col, row), cleanly clearing overwritten wide neighbors and clipping cleanly at the right edge.
§Arguments
&Self- Mutable grid.u16- Zero-based column coordinate.u16- Zero-based row coordinate.TerminalCell- Cell value to write.
§Returns
u16- Number of columns consumed (0,1, or2).
Sourcepub fn write_styled_text(
&mut self,
col: u16,
row: u16,
max_cols: u16,
text: &str,
style_cell: TerminalCell,
) -> u16
pub fn write_styled_text( &mut self, col: u16, row: u16, max_cols: u16, text: &str, style_cell: TerminalCell, ) -> u16
Writes UTF-8 text onto row starting at col within max_cols, honoring CJK double-width glyphs, zero-width combining marks, and clean edge truncation.
§Arguments
&Self- Mutable grid.u16- Starting zero-based column coordinate.u16- Target zero-based row coordinate.u16- Maximum display columns allowed for this write.&str- UTF-8 text slice to write.TerminalCell- Style template supplying foreground, background, bold, reverse, and underline flags.
§Returns
u16- Total display columns written.
Sourcepub fn write_text(
&mut self,
col: u16,
row: u16,
max_cols: u16,
text: &str,
) -> u16
pub fn write_text( &mut self, col: u16, row: u16, max_cols: u16, text: &str, ) -> u16
Writes UTF-8 text onto row starting at col using default terminal style within max_cols.
§Arguments
&Self- Mutable grid.u16- Starting zero-based column coordinate.u16- Target zero-based row coordinate.u16- Maximum display columns allowed.&str- UTF-8 text slice to write.
§Returns
u16- Total display columns written.
Sourcepub fn draw_box(
&mut self,
x: u16,
y: u16,
w: u16,
h: u16,
style_cell: TerminalCell,
)
pub fn draw_box( &mut self, x: u16, y: u16, w: u16, h: u16, style_cell: TerminalCell, )
Draws a Unicode box-drawing border frame covering [x, x + w) x [y, y + h).
§Arguments
&Self- Mutable grid.u16- Left column coordinate.u16- Top row coordinate.u16- Box width in columns.u16- Box height in rows.TerminalCell- Style template supplying foreground, background, bold, and reverse flags.
Sourcepub fn to_plain_text(&self) -> String
pub fn to_plain_text(&self) -> String
Source§impl TerminalCellGrid
impl TerminalCellGrid
pub fn get_cols(&self) -> u16
pub fn get_mut_cols(&mut self) -> &mut u16
pub fn set_cols(&mut self, val: u16) -> &mut Self
pub fn get_rows(&self) -> u16
pub fn get_mut_rows(&mut self) -> &mut u16
pub fn set_rows(&mut self, val: u16) -> &mut Self
pub fn get_cells(&self) -> &Vec<TerminalCell>
pub fn get_mut_cells(&mut self) -> &mut Vec<TerminalCell>
pub fn set_cells(&mut self, val: Vec<TerminalCell>) -> &mut Self
Trait Implementations§
Source§impl Clone for TerminalCellGrid
impl Clone for TerminalCellGrid
Source§impl Debug for TerminalCellGrid
impl Debug for TerminalCellGrid
Source§impl Default for TerminalCellGrid
impl Default for TerminalCellGrid
impl Eq for TerminalCellGrid
Source§impl PartialEq for TerminalCellGrid
impl PartialEq for TerminalCellGrid
impl StructuralPartialEq for TerminalCellGrid
Auto Trait Implementations§
impl Forget for TerminalCellGrid
impl Freeze for TerminalCellGrid
impl Move for TerminalCellGrid
impl RefUnwindSafe for TerminalCellGrid
impl Send for TerminalCellGrid
impl Sync for TerminalCellGrid
impl Unpin for TerminalCellGrid
impl UnsafeUnpin for TerminalCellGrid
impl UnwindSafe for TerminalCellGrid
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