Trait endbasic_std::console::Console [−][src]
pub trait Console {}Show methods
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<()>; 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<()>;
Expand description
Hooks to implement the commands that manipulate the console.
Required methods
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 hide_cursor(&mut self) -> Result<()>
fn hide_cursor(&mut self) -> Result<()>
Hides the cursor.
fn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
Returns true if the console is attached to an interactive terminal. This controls whether reading a line echoes back user input, for example.
Moves the cursor to the given position, which must be within the screen.
fn move_within_line(&mut self, off: i16) -> Result<()>
fn move_within_line(&mut self, off: i16) -> Result<()>
Moves the cursor within the line. Positive values move right, negative values move left.
Writes text
to the console, followed by a newline or CRLF pair depending on the needs of
the console to advance a line.
Waits for and returns the next key press.
fn show_cursor(&mut self) -> Result<()>
fn show_cursor(&mut self) -> Result<()>
Shows the cursor.
Queries the size of the console.
The returned position represents the first row and column that lay outside of the console.