[][src]Struct console::Term

pub struct Term { /* fields omitted */ }

Abstraction around a terminal.

A terminal can be cloned. If a buffer is used it's shared across all clones which means it largely acts as a handle.

Implementations

impl Term[src]

pub fn stdout() -> Term

Notable traits for Term

impl Read for Termimpl<'a> Read for &'a Termimpl Write for Termimpl<'a> Write for &'a Term
[src]

Return a new unbuffered terminal

pub fn stderr() -> Term

Notable traits for Term

impl Read for Termimpl<'a> Read for &'a Termimpl Write for Termimpl<'a> Write for &'a Term
[src]

Return a new unbuffered terminal to stderr

pub fn buffered_stdout() -> Term

Notable traits for Term

impl Read for Termimpl<'a> Read for &'a Termimpl Write for Termimpl<'a> Write for &'a Term
[src]

Return a new buffered terminal

pub fn buffered_stderr() -> Term

Notable traits for Term

impl Read for Termimpl<'a> Read for &'a Termimpl Write for Termimpl<'a> Write for &'a Term
[src]

Return a new buffered terminal to stderr

pub fn style(&self) -> Style[src]

Returns the style for the term

pub fn target(&self) -> TermTarget[src]

Returns the targert

pub fn write_line(&self, s: &str) -> Result<()>[src]

Writes a string to the terminal and adds a newline.

pub fn read_char(&self) -> Result<char>[src]

Read a single character from the terminal

This does not echo the character and blocks until a single character is entered.

pub fn read_key(&self) -> Result<Key>[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.

pub fn read_line(&self) -> Result<String>[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.

pub fn read_line_initial_text(&self, initial: &str) -> Result<String>[src]

Read one line of input with initial text.

This does not include the trailing newline. If the terminal is not user attended the return value will always be an empty string.

pub fn read_secure_line(&self) -> Result<String>[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.

pub fn flush(&self) -> Result<()>[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.

pub fn is_term(&self) -> bool[src]

👎 Deprecated since 0.13.0:

Use features().is_attended() instead

Checks if the terminal is indeed a terminal.

pub fn features(&self) -> TermFeatures<'_>[src]

Checks for common terminal features.

pub fn size(&self) -> (u16, u16)[src]

Returns the terminal size or gets sensible defaults.

pub 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.

pub fn move_cursor_to(&self, x: usize, y: usize) -> Result<()>[src]

Moves the cursor to x and y

pub fn move_cursor_up(&self, n: usize) -> Result<()>[src]

Moves the cursor up n lines

pub fn move_cursor_down(&self, n: usize) -> Result<()>[src]

Moves the cursor down n lines

pub fn move_cursor_left(&self, n: usize) -> Result<()>[src]

Moves the cursor left n lines

pub fn move_cursor_right(&self, n: usize) -> Result<()>[src]

Moves the cursor down n lines

pub fn clear_line(&self) -> Result<()>[src]

Clears the current line.

The positions the cursor at the beginning of the line again.

pub fn clear_last_lines(&self, n: usize) -> Result<()>[src]

Clear the last n lines.

This positions the cursor at the beginning of the first line that was cleared.

pub fn clear_screen(&self) -> Result<()>[src]

Clears the entire screen.

pub fn clear_to_end_of_screen(&self) -> Result<()>[src]

Clears the entire screen.

pub fn clear_chars(&self, n: usize) -> Result<()>[src]

Clears the last char in the the current line.

pub fn set_title<T: Display>(&self, title: T)[src]

Set the terminal title

pub fn show_cursor(&self) -> Result<()>[src]

Makes cursor visible again

pub fn hide_cursor(&self) -> Result<()>[src]

Hides cursor

Trait Implementations

impl AsRawFd for Term[src]

impl Clone for Term[src]

impl Debug for Term[src]

impl Read for Term[src]

impl<'a> Read for &'a Term[src]

impl Write for Term[src]

impl<'a> Write for &'a Term[src]

Auto Trait Implementations

impl RefUnwindSafe for Term

impl Send for Term

impl Sync for Term

impl Unpin for Term

impl UnwindSafe for Term

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.