Struct rushell_deps_linefeed::memory::MemoryTerminal [−][src]
pub struct MemoryTerminal { /* fields omitted */ }
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
impl MemoryTerminal
[src]
impl MemoryTerminal
[src]pub fn new() -> MemoryTerminal
[src]
pub fn new() -> MemoryTerminal
[src]Returns a new MemoryTerminal
with the default buffer size.
pub fn with_size(size: Size) -> MemoryTerminal
[src]
pub fn with_size(size: Size) -> MemoryTerminal
[src]Returns a new MemoryTerminal
with the given buffer size.
Panics
If either of the lines
or columns
fields are 0
.
pub fn clear_to_end(&self)
[src]
pub fn clear_to_end(&self)
[src]Clears all characters beginning at the cursor and ending at buffer end.
pub fn clear_input(&self)
[src]
pub fn clear_input(&self)
[src]Clears the input buffer.
pub fn lines(&self) -> Lines<'_>
[src]
pub fn lines(&self) -> Lines<'_>
[src]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.
pub fn move_right(&self, n: usize)
[src]
pub fn move_right(&self, n: usize)
[src]Moves the cursor right n
cells.
pub fn move_to_first_column(&self)
[src]
pub fn move_to_first_column(&self)
[src]Moves the cursor to the first column of the current line.
pub fn push_input(&self, s: &str)
[src]
pub fn push_input(&self, s: &str)
[src]Pushes a character sequence to the back of the input queue.
pub fn resize(&self, new_size: Size)
[src]
pub fn resize(&self, new_size: Size)
[src]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.
pub fn scroll_up(&self, n: usize)
[src]
pub fn scroll_up(&self, n: usize)
[src]Moves the contents of the buffer up n
lines.
The first n
lines of text will be erased.
pub fn set_cursor_mode(&self, mode: CursorMode)
[src]
pub fn set_cursor_mode(&self, mode: CursorMode)
[src]Sets the cursor mode.
pub fn cursor_mode(&self) -> CursorMode
[src]
pub fn cursor_mode(&self) -> CursorMode
[src]Returns the cursor mode.
Trait Implementations
impl Clone for MemoryTerminal
[src]
impl Clone for MemoryTerminal
[src]fn clone(&self) -> MemoryTerminal
[src]
fn clone(&self) -> MemoryTerminal
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for MemoryTerminal
[src]
impl Debug for MemoryTerminal
[src]impl Default for MemoryTerminal
[src]
impl Default for MemoryTerminal
[src]fn default() -> MemoryTerminal
[src]
fn default() -> MemoryTerminal
[src]Returns the “default value” for a type. Read more
impl Terminal for MemoryTerminal
[src]
impl Terminal for MemoryTerminal
[src]type PrepareState = ()
type PrepareState = ()
Returned by prepare
; passed to restore
to restore state.
fn lock_read<'a>(&'a self) -> Box<dyn TerminalReader<Self> + 'a>
[src]
fn lock_read<'a>(&'a self) -> Box<dyn TerminalReader<Self> + 'a>
[src]Acquires a lock on terminal read operations and returns a value holding that lock and granting access to such operations. Read more
fn lock_write<'a>(&'a self) -> Box<dyn TerminalWriter<Self> + 'a>
[src]
fn lock_write<'a>(&'a self) -> Box<dyn TerminalWriter<Self> + 'a>
[src]Acquires a lock on terminal write operations and returns a value holding that lock and granting access to such operations. Read more
impl<'a> TerminalReader<MemoryTerminal> for MemoryReadGuard<'a>
[src]
impl<'a> TerminalReader<MemoryTerminal> for MemoryReadGuard<'a>
[src]fn wait_for_input(&mut self, _timeout: Option<Duration>) -> Result<bool>
[src]
fn wait_for_input(&mut self, _timeout: Option<Duration>) -> Result<bool>
[src]Waits timeout
for user input. If timeout
is None
, waits indefinitely. Read more
fn prepare(
&mut self,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
[src]
fn prepare(
&mut self,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
[src]Prepares the terminal for line reading and editing operations. Read more
unsafe fn prepare_with_lock(
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
[src]
unsafe fn prepare_with_lock(
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
[src]Like prepare
, but called when the write lock is already held. Read more
fn restore(&mut self, _state: ()) -> Result<()>
[src]
fn restore(&mut self, _state: ()) -> Result<()>
[src]Restores the terminal state using the given state data.
unsafe fn restore_with_lock(
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_state: ()
) -> Result<()>
[src]
unsafe fn restore_with_lock(
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_state: ()
) -> Result<()>
[src]Like restore
, but called when the write lock is already held. Read more
impl<'a> TerminalWriter<MemoryTerminal> for MemoryWriteGuard<'a>
[src]
impl<'a> TerminalWriter<MemoryTerminal> for MemoryWriteGuard<'a>
[src]fn clear_screen(&mut self) -> Result<()>
[src]
fn clear_screen(&mut self) -> Result<()>
[src]Presents a clear terminal screen, with cursor at first row, first column. Read more
fn clear_to_screen_end(&mut self) -> Result<()>
[src]
fn clear_to_screen_end(&mut self) -> Result<()>
[src]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
fn move_right(&mut self, n: usize) -> Result<()>
[src]
fn move_right(&mut self, n: usize) -> Result<()>
[src]Moves the cursor right n
cells; n
may be zero.
fn move_to_first_column(&mut self) -> Result<()>
[src]
fn move_to_first_column(&mut self) -> Result<()>
[src]Moves the cursor to the first column of the current line
fn set_cursor_mode(&mut self, mode: CursorMode) -> Result<()>
[src]
fn set_cursor_mode(&mut self, mode: CursorMode) -> Result<()>
[src]Set the current cursor mode
Auto Trait Implementations
impl RefUnwindSafe for MemoryTerminal
impl Send for MemoryTerminal
impl Sync for MemoryTerminal
impl Unpin for MemoryTerminal
impl UnwindSafe for MemoryTerminal
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more