[][src]Struct tuikit::screen::Screen

pub struct Screen { /* fields omitted */ }

A Screen is a table of cells to draw on. It's a buffer holding the contents

Implementations

impl Screen[src]

pub fn new(width: usize, height: usize) -> Self[src]

create an empty screen with size: (width, height)

pub fn width(&self) -> usize[src]

get the width of the screen

pub fn height(&self) -> usize[src]

get the height of the screen

pub fn resize(&mut self, width: usize, height: usize)[src]

to resize the screen to (width, height)

pub fn present(&mut self) -> Vec<Command>[src]

sync internal buffer with the terminal

pub fn iter_cell(&self) -> CellIterator<'_>

Notable traits for CellIterator<'a>

impl<'a> Iterator for CellIterator<'a> type Item = (usize, usize, &'a Cell);
[src]

use tuikit::cell::Cell;
use tuikit::canvas::Canvas;
use tuikit::screen::Screen;


let mut screen = Screen::new(1, 1);
screen.put_cell(0, 0, Cell{ ch: 'a', ..Cell::default()});
let mut iter = screen.iter_cell();
assert_eq!(Some((0, 0, &Cell{ ch: 'a', ..Cell::default()})), iter.next());
assert_eq!(None, iter.next());

Trait Implementations

impl Canvas for Screen[src]

fn size(&self) -> Result<(usize, usize)>[src]

Get the canvas size (width, height)

fn clear(&mut self) -> Result<()>[src]

clear the screen buffer

fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize>[src]

change a cell of position (row, col) to cell

fn set_cursor(&mut self, row: usize, col: usize) -> Result<()>[src]

move cursor position (row, col) and show cursor

fn show_cursor(&mut self, show: bool) -> Result<()>[src]

show/hide cursor, set show to false to hide the cursor

impl Debug for Screen[src]

Auto Trait Implementations

impl RefUnwindSafe for Screen

impl Send for Screen

impl Sync for Screen

impl Unpin for Screen

impl UnwindSafe for Screen

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.