Trait endbasic_std::console::Console[][src]

pub trait Console {
    fn clear(&mut self, how: ClearType) -> Result<()>;
fn color(&mut self, fg: Option<u8>, bg: Option<u8>) -> Result<()>;
fn enter_alt(&mut self) -> Result<()>;
fn hide_cursor(&mut self) -> Result<()>;
fn is_interactive(&self) -> bool;
fn leave_alt(&mut self) -> Result<()>;
fn locate(&mut self, pos: Position) -> Result<()>;
fn move_within_line(&mut self, off: i16) -> Result<()>;
fn print(&mut self, text: &str) -> Result<()>;
#[must_use] fn read_key<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Key>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn show_cursor(&mut self) -> Result<()>;
fn size(&self) -> Result<Position>;
fn write(&mut self, bytes: &[u8]) -> Result<()>; }

Hooks to implement the commands that manipulate the console.

Required methods

fn clear(&mut self, how: ClearType) -> Result<()>[src]

Clears the part of the console given by how.

fn color(&mut self, fg: Option<u8>, bg: Option<u8>) -> Result<()>[src]

Sets the console's foreground and background colors to fg and bg.

If any of the colors is None, the color is left unchanged.

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

Enters the alternate console.

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

Hides the cursor.

fn is_interactive(&self) -> bool[src]

Returns true if the console is attached to an interactive terminal. This controls whether reading a line echoes back user input, for example.

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

Leaves the alternate console.

fn locate(&mut self, pos: Position) -> Result<()>[src]

Moves the cursor to the given position, which must be within the screen.

fn move_within_line(&mut self, off: i16) -> Result<()>[src]

Moves the cursor within the line. Positive values move right, negative values move left.

fn print(&mut self, text: &str) -> Result<()>[src]

Writes text to the console, followed by a newline or CRLF pair depending on the needs of the console to advance a line.

#[must_use]fn read_key<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Key>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Waits for and returns the next key press.

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

Shows the cursor.

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

Queries the size of the console.

The returned position represents the first row and column that lay outside of the console.

fn write(&mut self, bytes: &[u8]) -> Result<()>[src]

Writes the raw bytes into the console.

Loading content...

Implementors

impl Console for TerminalConsole[src]

impl Console for MockConsole[src]

Loading content...