Trait AsciiConsole

Source
pub trait AsciiConsole: BaseConsole {
    // Required methods
    fn write_char_at(
        &mut self,
        ch: u8,
        pos: Position,
    ) -> Result<(), Self::Error>;
    fn handle_escape(&mut self, escaped_char: u8) -> bool;

    // Provided methods
    fn write_string(&mut self, s: &[u8]) -> Result<(), Self::Error> { ... }
    fn write_character(&mut self, ch: u8) -> Result<(), Self::Error> { ... }
    fn write_string_at(
        &mut self,
        s: &[u8],
        pos: Position,
    ) -> Result<(), Self::Error> { ... }
    fn is_special(&self, ch: u8) -> Option<SpecialChar> { ... }
}
Expand description

Refinement of BaseConsole which supports 8-bit characters. Use this is you are implementing an old-fashioned ASCII console (including extended ASCII, like Code Page 850, or ISO 8859-1).

Required Methods§

Source

fn write_char_at(&mut self, ch: u8, pos: Position) -> Result<(), Self::Error>

Write a single 8-bit char to the screen at the given position without updating the current position.

Source

fn handle_escape(&mut self, escaped_char: u8) -> bool

Called when they’ve used an escape character in the string. Currently you can only escape a single byte. The escape character is 0x1B. This function returns ‘true’ when the escape sequence is complete.

Provided Methods§

Source

fn write_string(&mut self, s: &[u8]) -> Result<(), Self::Error>

Write an 8-bit string to the screen at the given position. Updates the current position to the end of the string. Strings will wrap across the end of the screen and scroll the screen if they reach the bottom.

Source

fn write_character(&mut self, ch: u8) -> Result<(), Self::Error>

Write a single 8-bit char to the screen at the current position.

Source

fn write_string_at( &mut self, s: &[u8], pos: Position, ) -> Result<(), Self::Error>

Write an 8-bit string to the screen at the given position. Updates the current position to the end of the string. Strings will wrap across the end of the screen and scroll the screen if they reach the bottom.

Source

fn is_special(&self, ch: u8) -> Option<SpecialChar>

Check if an 8-bit char is special

Implementors§