Struct endbasic_terminal::TerminalConsole
source · pub struct TerminalConsole { /* private fields */ }Expand description
Implementation of the EndBASIC console to interact with stdin and stdout.
Implementations§
source§impl TerminalConsole
impl TerminalConsole
sourcepub fn from_stdio(signals_tx: Sender<Signal>) -> Result<Self>
pub fn from_stdio(signals_tx: Sender<Signal>) -> Result<Self>
Creates a new console based on the properties of stdin/stdout.
This spawns a background task to handle console input so this must be run in the context of an Tokio runtime.
Trait Implementations§
source§impl Console for TerminalConsole
impl Console for TerminalConsole
source§fn clear(&mut self, how: ClearType) -> Result<()>
fn clear(&mut self, how: ClearType) -> Result<()>
Clears the part of the console given by
how.source§fn color(&self) -> (Option<u8>, Option<u8>)
fn color(&self) -> (Option<u8>, Option<u8>)
Gets the console’s current foreground and background colors.
source§fn hide_cursor(&mut self) -> Result<()>
fn hide_cursor(&mut self) -> Result<()>
Hides the cursor.
source§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.
source§fn locate(&mut self, pos: CharsXY) -> Result<()>
fn locate(&mut self, pos: CharsXY) -> Result<()>
Moves the cursor to the given position, which must be within the screen.
source§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.
source§fn print(&mut self, text: &str) -> Result<()>
fn print(&mut self, text: &str) -> Result<()>
Writes
text to the console, followed by a newline or CRLF pair depending on the needs of
the console to advance a line. Read moresource§fn poll_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Option<Key>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn poll_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Option<Key>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the next key press if any is available.
source§fn read_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Key>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Key>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Waits for and returns the next key press.
source§fn show_cursor(&mut self) -> Result<()>
fn show_cursor(&mut self) -> Result<()>
Shows the cursor.
source§fn write(&mut self, text: &str) -> Result<()>
fn write(&mut self, text: &str) -> Result<()>
Writes the text into the console at the position of the cursor.
source§fn set_sync(&mut self, enabled: bool) -> Result<bool>
fn set_sync(&mut self, enabled: bool) -> Result<bool>
Enables or disables video syncing. Read more
source§fn size_pixels(&self) -> Result<SizeInPixels, Error>
fn size_pixels(&self) -> Result<SizeInPixels, Error>
Queries the size of the graphical console.
source§fn draw_circle(&mut self, _center: PixelsXY, _radius: u16) -> Result<(), Error>
fn draw_circle(&mut self, _center: PixelsXY, _radius: u16) -> Result<(), Error>
Draws the outline of a circle at
_center with _radius using the current drawing color.source§fn draw_circle_filled(
&mut self,
_center: PixelsXY,
_radius: u16
) -> Result<(), Error>
fn draw_circle_filled(
&mut self,
_center: PixelsXY,
_radius: u16
) -> Result<(), Error>
Draws a filled circle at
_center with _radius using the current drawing color.source§fn draw_line(&mut self, _x1y1: PixelsXY, _x2y2: PixelsXY) -> Result<(), Error>
fn draw_line(&mut self, _x1y1: PixelsXY, _x2y2: PixelsXY) -> Result<(), Error>
Draws a line from
_x1y1 to _x2y2 using the current drawing color.source§fn draw_pixel(&mut self, _xy: PixelsXY) -> Result<(), Error>
fn draw_pixel(&mut self, _xy: PixelsXY) -> Result<(), Error>
Draws a single pixel at
_xy using the current drawing color.