Struct endbasic_terminal::TerminalConsole
source · [−]pub struct TerminalConsole { /* private fields */ }Expand description
Implementation of the EndBASIC console to interact with stdin and stdout.
Implementations
sourceimpl TerminalConsole
impl TerminalConsole
sourcepub fn from_stdio() -> Result<Self>
pub fn from_stdio() -> Result<Self>
Creates a new console based on the properties of stdin/stdout.
Trait Implementations
sourceimpl Console for TerminalConsole
impl Console for TerminalConsole
sourcefn color(&mut self, fg: Option<u8>, bg: Option<u8>) -> Result<()>
fn color(&mut self, fg: Option<u8>, bg: Option<u8>) -> Result<()>
Sets the console’s foreground and background colors to fg and bg. Read more
sourcefn hide_cursor(&mut self) -> Result<()>
fn hide_cursor(&mut self) -> Result<()>
Hides the cursor.
sourcefn 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. Read more
sourcefn 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.
sourcefn 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.
sourcefn 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 more
sourcefn poll_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Option<Key>>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn poll_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Option<Key>>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Returns the next key press if any is available.
sourcefn 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 read_key<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Key>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Waits for and returns the next key press.
sourcefn show_cursor(&mut self) -> Result<()>
fn show_cursor(&mut self) -> Result<()>
Shows the cursor.
sourcefn 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. Read more
sourcefn set_sync(&mut self, enabled: bool) -> Result<()>
fn set_sync(&mut self, enabled: bool) -> Result<()>
Enables or disables video syncing. Read more
sourcefn 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.
sourcefn 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.
Auto Trait Implementations
impl RefUnwindSafe for TerminalConsole
impl Send for TerminalConsole
impl Sync for TerminalConsole
impl Unpin for TerminalConsole
impl UnwindSafe for TerminalConsole
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more