Trait UnicodeConsole

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

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

Refinement of BaseConsole which supports Unicode characters. Use this is you are implementing a modern console with Unicode support.

Required Methods§

Source

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

Write a single Unicode char to the screen at the given position without updating the current position.

Source

fn handle_escape(&mut self, escaped_char: char) -> 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: &str) -> Result<(), Self::Error>

Write a 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: char) -> Result<(), Self::Error>

Write a single Unicode char to the screen at the current position.

Source

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

Write a 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: char) -> Option<SpecialChar>

Check if a char is special

Implementors§