Struct mortal::terminal::TerminalReadGuard
source · [−]pub struct TerminalReadGuard<'a>(_);
Expand description
Holds an exclusive lock for read operations on a Terminal
See Terminal
documentation for details on locking.
Implementations
sourceimpl<'a> TerminalReadGuard<'a>
impl<'a> TerminalReadGuard<'a>
sourcepub fn prepare(&mut self, config: PrepareConfig) -> Result<PrepareState>
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.
sourcepub fn prepare_with_lock(
&mut self,
writer: &mut TerminalWriteGuard<'_>,
config: PrepareConfig
) -> Result<PrepareState>
pub fn prepare_with_lock(
&mut self,
writer: &mut TerminalWriteGuard<'_>,
config: PrepareConfig
) -> Result<PrepareState>
Performs terminal preparation using both Terminal
locks.
sourcepub fn restore(&mut self, state: PrepareState) -> Result<()>
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.
sourcepub fn restore_with_lock(
&mut self,
writer: &mut TerminalWriteGuard<'_>,
state: PrepareState
) -> Result<()>
pub fn restore_with_lock(
&mut self,
writer: &mut TerminalWriteGuard<'_>,
state: PrepareState
) -> Result<()>
Performs terminal state restoration using both Terminal
locks.
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more