pub struct Grid { /* private fields */ }Implementations§
Source§impl Grid
impl Grid
pub fn new(width: u16, height: u16) -> Self
pub fn width(&self) -> u16
pub fn height(&self) -> u16
pub fn resize(&mut self, width: u16, height: u16)
pub fn cell(&self, x: u16, y: u16) -> &Cell
Sourcepub fn cell_mut(&mut self, x: u16, y: u16) -> Option<&mut Cell>
pub fn cell_mut(&mut self, x: u16, y: u16) -> Option<&mut Cell>
Mutable cell access; returns None when out of bounds.
Escape hatch that bypasses the wide-char continuation invariant
upheld by set / put_char / fill. Callers must own the entire
region they write into and re-establish the invariant themselves
(e.g. snapshot.rs stamps \0 continuations explicitly). For any
normal painting, prefer set / put_str / put_char / fill.
pub fn set(&mut self, x: u16, y: u16, symbol: char, style: Style)
pub fn put_str(&mut self, x: u16, y: u16, text: &str, style: Style) -> u16
Sourcepub fn put_char(&mut self, x: u16, y: u16, symbol: char, fg: Color)
pub fn put_char(&mut self, x: u16, y: u16, symbol: char, fg: Color)
Overwrites symbol and style.fg; preserves the existing cell’s
bg and text attributes. Use for fg-only painting over a filled background.
Sourcepub fn put_str_fg(&mut self, x: u16, y: u16, text: &str, fg: Color) -> u16
pub fn put_str_fg(&mut self, x: u16, y: u16, text: &str, fg: Color) -> u16
String form of Grid::put_char: overwrites symbol + fg, preserves bg and attrs.
Sourcepub fn put_line(&mut self, x: u16, y: u16, line: &Line<'_>) -> u16
pub fn put_line(&mut self, x: u16, y: u16, line: &Line<'_>) -> u16
Paint a [Line] of styled spans at (x, y), clipping at the right edge.
pub fn fill(&mut self, area: Rect, symbol: char, style: Style)
pub fn clear(&mut self, area: Rect)
pub fn clear_all(&mut self)
pub fn slice_mut(&mut self, area: Rect) -> GridSlice<'_>
pub fn diff<'a>( &'a self, prev: &'a Grid, ) -> impl Iterator<Item = CellUpdate<'a>>
pub fn swap_with(&mut self, other: &mut Grid)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin for Grid
impl UnwindSafe for Grid
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