[−][src]Struct mortal::terminal::TerminalReadGuard
Holds an exclusive lock for read operations on a Terminal
See Terminal
documentation for details on locking.
Methods
impl<'a> TerminalReadGuard<'a>
[src]
pub fn prepare(&mut self, config: PrepareConfig) -> Result<PrepareState>
[src]
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]
&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]
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]
&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]
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]
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]
Auto Trait Implementations
impl<'a> RefUnwindSafe for TerminalReadGuard<'a>
impl<'a> !Send for TerminalReadGuard<'a>
impl<'a> Sync for TerminalReadGuard<'a>
impl<'a> Unpin for TerminalReadGuard<'a>
impl<'a> UnwindSafe for TerminalReadGuard<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,