Struct mortal::terminal::TerminalReadGuard [−][src]
pub struct TerminalReadGuard<'a>(_);
Holds an exclusive lock for read operations on a Terminal
See Terminal
documentation for details on locking.
Methods
impl<'a> TerminalReadGuard<'a>
[src]
impl<'a> TerminalReadGuard<'a>
pub fn prepare(&mut self, config: PrepareConfig) -> Result<PrepareState>
[src]
pub fn prepare(&mut self, config: PrepareConfig) -> Result<PrepareState>
Prepares the terminal to read input.
When reading operations have concluded, restore
should be called with the resulting PrepareState
value to restore
the terminal to its previous state.
This method may be called more than once before a corresponding
restore
call. However, each restore
call must receive the most recently
created PrepareState
value.
See PrepareConfig
for details.
Locking
This method internally acquires the Terminal
write lock.
If the write lock is already held by the current thread,
call prepare_with_lock
, in order to prevent deadlocks.
pub fn prepare_with_lock(
&mut self,
writer: &mut TerminalWriteGuard,
config: PrepareConfig
) -> Result<PrepareState>
[src]
pub fn prepare_with_lock(
&mut self,
writer: &mut TerminalWriteGuard,
config: PrepareConfig
) -> Result<PrepareState>
Performs terminal preparation using both Terminal
locks.
pub fn restore(&mut self, state: PrepareState) -> Result<()>
[src]
pub fn restore(&mut self, state: PrepareState) -> Result<()>
Restores the terminal to its previous state.
Locking
This method internally acquires the Terminal
write lock.
If the write lock is already held by the current thread,
call restore_with_lock
, in order to prevent deadlocks.
pub fn restore_with_lock(
&mut self,
writer: &mut TerminalWriteGuard,
state: PrepareState
) -> Result<()>
[src]
pub fn restore_with_lock(
&mut self,
writer: &mut TerminalWriteGuard,
state: PrepareState
) -> Result<()>
Performs terminal state restoration using both Terminal
locks.
pub fn wait_event(&mut self, timeout: Option<Duration>) -> Result<bool>
[src]
pub fn wait_event(&mut self, timeout: Option<Duration>) -> Result<bool>
Waits for an event from the terminal.
Returns Ok(false)
if timeout
elapses without an event occurring.
If timeout
is None
, this method will wait indefinitely.
pub fn read_event(&mut self, timeout: Option<Duration>) -> Result<Option<Event>>
[src]
pub fn read_event(&mut self, timeout: Option<Duration>) -> Result<Option<Event>>
Waits for input and reads an event from the terminal.
Returns Ok(None)
if timeout
elapses without an event occurring.
If timeout
is None
, this method will wait indefinitely.
Trait Implementations
impl<'a> TerminalExt for TerminalReadGuard<'a>
[src]
impl<'a> TerminalExt for TerminalReadGuard<'a>
Auto Trait Implementations
impl<'a> !Send for TerminalReadGuard<'a>
impl<'a> !Send for TerminalReadGuard<'a>
impl<'a> Sync for TerminalReadGuard<'a>
impl<'a> Sync for TerminalReadGuard<'a>