Struct stdcli::term::console::Term
[−]
[src]
pub struct Term { /* fields omitted */ }
Abstraction around a terminal.
Methods
impl Term
[src]
fn stdout() -> Term
[src]
Return a new unbuffered terminal
fn stderr() -> Term
[src]
Return a new unbuffered terminal to stderr
fn buffered_stdout() -> Term
[src]
Return a new buffered terminal
fn buffered_stderr() -> Term
[src]
Return a new buffered terminal to stderr
fn write_line(&self, s: &str) -> Result<(), Error>
[src]
Writes a string to the terminal and adds a newline.
fn read_char(&self) -> Result<char, Error>
[src]
Read a single character from the terminal
This does not echo the character and blocks until a single character is entered.
fn read_key(&self) -> Result<Key, Error>
[src]
Read a single key form the terminal.
This does not echo anything. If the terminal is not user attended the return value will always be the unknown key.
fn read_line(&self) -> Result<String, Error>
[src]
Read one line of input.
This does not include the trailing newline. If the terminal is not user attended the return value will always be an empty string.
fn read_secure_line(&self) -> Result<String, Error>
[src]
Read securely a line of input.
This is similar to read_line
but will not echo the output. This
also switches the terminal into a different mode where not all
characters might be accepted.
fn flush(&self) -> Result<(), Error>
[src]
Flushes internal buffers.
This forces the contents of the internal buffer to be written to the terminal. This is unnecessary for unbuffered terminals which will automatically flush.
fn is_term(&self) -> bool
[src]
Checks if the terminal is indeed a terminal.
Alternatively you can use the user_attended
function which does
the same.
fn want_emoji(&self) -> bool
[src]
Checks if this terminal wants emoji output.
fn size(&self) -> (u16, u16)
[src]
Returns the terminal size or gets sensible defaults.
fn size_checked(&self) -> Option<(u16, u16)>
[src]
Returns the terminal size in rows and columns.
If the size cannot be reliably determined None is returned.
fn move_cursor_up(&self, n: usize) -> Result<(), Error>
[src]
Moves the cursor up n
lines
fn move_cursor_down(&self, n: usize) -> Result<(), Error>
[src]
Moves the cursor down n
lines
fn clear_line(&self) -> Result<(), Error>
[src]
Clears the current line.
The positions the cursor at the beginning of the line again.
fn clear_last_lines(&self, n: usize) -> Result<(), Error>
[src]
Clear the last n
lines.
This positions the cursor at the beginning of the first line that was cleared.