Module console

Source
Expand description

Console representation and manipulation.

Re-exports§

pub use graphics::GraphicsConsole;

Modules§

drawing
Drawing algorithms for consoles that don’t provide native rendering primitives.
graphics
Support to implement graphical consoles.

Structs§

CharsXY
Represents a coordinate for character-based console operations.
LineBuffer
Abstraction over a string to handle manipulation operations at char boundaries.
PixelsXY
Represents a coordinate for pixel-based console operations.
SizeInPixels
Represents a rectangular size in pixels.
TrivialConsole
Implementation of the EndBASIC console with minimal functionality.

Enums§

AnsiColor
Identifiers for the basic ANSI colors.
ClearType
Indicates what part of the console to clear on a Console::clear() call.
Key
Decoded key presses as returned by the console.

Traits§

Console
Hooks to implement the commands that manipulate the console.

Functions§

ansi_color_to_rgb
Converts an ANSI color number to an RGB color.
get_env_var_as_u16
Gets the value of the environment variable name and interprets it as a u16. Returns None if the variable is not set or if its contents are invalid.
has_control_chars
Checks if a given string has control characters.
is_narrow
Returns true if the console is too narrow for the standard interface.
read_key_from_stdin
Reads a single key from stdin when not attached to a TTY. Because characters are not visible to us until a newline is received, this reads complete lines and buffers them in memory inside the given buffer.
read_line
Reads a line from the console. If the console is interactive, this does fancy line editing and uses the given prompt and pre-fills the input with previous.
read_line_secure
Reads a line from the console without echo using the given prompt.
refill_and_print
Same as refill but prints the lines of each paragraph to the console instead of returning them and prefixes them with an optional indent.
remove_control_chars
Removes control characters from a string to make it suitable for printing.

Type Aliases§

RGB
Represents an RGB color in [0,255] quantities.