pub struct MemoryTerminal { /* private fields */ }
Expand description

Implements an in-memory Terminal interface

The contents of a MemoryTerminal are shared. That is, cloning a MemoryTerminal value will share the contained terminal buffer.

Implementations

Returns a new MemoryTerminal with the default buffer size.

Returns a new MemoryTerminal with the given buffer size.

Panics

If either of the lines or columns fields are 0.

Clears the terminal buffer and places the cursor at (0, 0).

Clears all characters beginning at the cursor and ending at buffer end.

Clears the input buffer.

Returns whether any input remains to be read.

Returns an iterator over lines in the buffer.

Notes

The returned iterator immutably borrows the contents of the MemoryTerminal. Attempting to perform a mutating operation on the parent MemoryTerminal while the Lines iterator lives will cause a panic.

Moves the cursor up n cells.

Moves the cursor down n cells.

Moves the cursor left n cells.

Moves the cursor right n cells.

Moves the cursor to the first column of the current line.

Pushes a character sequence to the back of the input queue.

Reads some input from the input buffer.

Changes the size of the terminal buffer. The buffer will be truncated or filled with spaces, as necessary.

Panics

If either of the lines or columns fields are 0 or if the area exceeds usize maximum.

Moves the contents of the buffer up n lines. The first n lines of text will be erased.

Returns the (line, column) position of the cursor.

Sets the cursor mode.

Returns the cursor mode.

Returns the size of the terminal buffer.

Writes some text into the buffer.

If the text extends beyond the length of the current line without a newline character ('\n'), the extraneous text will be dropped.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Returned by prepare; passed to restore to restore state.
Returns the name of the terminal.
Acquires a lock on terminal read operations and returns a value holding that lock and granting access to such operations. Read more
Acquires a lock on terminal write operations and returns a value holding that lock and granting access to such operations. Read more
Waits timeout for user input. If timeout is None, waits indefinitely. Read more
Prepares the terminal for line reading and editing operations. Read more
Like prepare, but called when the write lock is already held. Read more
Restores the terminal state using the given state data.
Like restore, but called when the write lock is already held. Read more
Reads some input from the terminal and appends it to the given buffer.
Returns the size of the terminal window
Presents a clear terminal screen, with cursor at first row, first column. Read more
Clears characters on the line occupied by the cursor, beginning with the cursor and ending at the end of the line. Also clears all characters on all lines after the cursor. Read more
Moves the cursor up n cells; n may be zero.
Moves the cursor down n cells; n may be zero.
Moves the cursor left n cells; n may be zero.
Moves the cursor right n cells; n may be zero.
Moves the cursor to the first column of the current line
Set the current cursor mode
Writes output to the terminal. Read more
Flushes any currently buffered output data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.