[][src]Trait endbasic_core::console::Console

pub trait Console {
    pub fn clear(&mut self, how: ClearType) -> Result<()>;
pub fn color(&mut self, fg: Option<u8>, bg: Option<u8>) -> Result<()>;
pub fn enter_alt(&mut self) -> Result<()>;
pub fn hide_cursor(&mut self) -> Result<()>;
pub fn is_interactive(&self) -> bool;
pub fn leave_alt(&mut self) -> Result<()>;
pub fn locate(&mut self, pos: Position) -> Result<()>;
pub fn move_within_line(&mut self, off: i16) -> Result<()>;
pub fn print(&mut self, text: &str) -> Result<()>;
#[must_use] pub 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
;
pub fn show_cursor(&mut self) -> Result<()>;
pub fn size(&self) -> Result<Position>;
pub fn write(&mut self, bytes: &[u8]) -> Result<()>; }

Hooks to implement the commands that manipulate the console.

Required methods

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

Clears the part of the console given by how.

pub 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.

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

Enters the alternate console.

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

Hides the cursor.

pub 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.

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

Leaves the alternate console.

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

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

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

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

pub 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]pub 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.

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

Shows the cursor.

pub 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.

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

Writes the raw bytes into the console.

Loading content...

Implementors

Loading content...