pub struct ScreenBuffer { /* private fields */ }Expand description
A simple screen buffer for terminal content.
This provides basic screen buffer functionality. For full terminal
emulation, use the screen feature which provides a more complete
implementation.
Implementations§
Source§impl ScreenBuffer
impl ScreenBuffer
Sourcepub fn new(dimensions: Dimensions) -> Self
pub fn new(dimensions: Dimensions) -> Self
Create a new screen buffer.
Sourcepub const fn dimensions(&self) -> Dimensions
pub const fn dimensions(&self) -> Dimensions
Get the screen dimensions.
Sourcepub fn set_cursor(&mut self, pos: Position)
pub fn set_cursor(&mut self, pos: Position)
Set the cursor position.
Sourcepub fn move_cursor(&mut self, rows: isize, cols: isize)
pub fn move_cursor(&mut self, rows: isize, cols: isize)
Move the cursor.
Sourcepub const fn save_cursor(&mut self)
pub const fn save_cursor(&mut self)
Save the cursor position.
Sourcepub const fn restore_cursor(&mut self)
pub const fn restore_cursor(&mut self)
Restore the cursor position.
Sourcepub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut Cell>
pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut Cell>
Get a mutable cell at a position.
Sourcepub fn put_char(&mut self, c: char, attrs: CellAttributes)
pub fn put_char(&mut self, c: char, attrs: CellAttributes)
Put a character at the cursor position.
Sourcepub fn region_text(&self, region: Region) -> String
pub fn region_text(&self, region: Region) -> String
Get text in a region.
Sourcepub fn clear_region(&mut self, region: Region)
pub fn clear_region(&mut self, region: Region)
Clear a region.
Sourcepub fn scroll_down(&mut self, n: usize)
pub fn scroll_down(&mut self, n: usize)
Scroll the screen down by n lines.
Sourcepub const fn set_scroll_region(&mut self, top: usize, bottom: usize)
pub const fn set_scroll_region(&mut self, top: usize, bottom: usize)
Set the scroll region.
Sourcepub fn resize(&mut self, dimensions: Dimensions)
pub fn resize(&mut self, dimensions: Dimensions)
Resize the screen.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScreenBuffer
impl RefUnwindSafe for ScreenBuffer
impl Send for ScreenBuffer
impl Sync for ScreenBuffer
impl Unpin for ScreenBuffer
impl UnwindSafe for ScreenBuffer
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