pub struct SuspendGuard<'a, W: Write> { /* private fields */ }Expand description
RAII guard returned by Crossterm::suspend; see that method’s docs for the full contract.
Borrows the suspended Crossterm mutably for its whole lifetime, so no other method on it
can be called (accidentally drawing, polling, or moving the cursor) while the real terminal is
handed back to the OS/shell.
Implementations§
Source§impl<W: Write> SuspendGuard<'_, W>
impl<W: Write> SuspendGuard<'_, W>
Sourcepub fn resume(self) -> Result<()>
pub fn resume(self) -> Result<()>
Restores every option the suspended Crossterm was originally built with and forces a
full redraw on the next [Output::draw]. Equivalent to letting the guard drop, but lets a
caller observe the std::io::Error a dropped guard would otherwise discard.
§Errors
Returns an std::io::Error if any of the terminal-restoring commands fail (e.g. a closed
terminal or disconnected pipe).
Trait Implementations§
Source§impl<W: Write> Drop for SuspendGuard<'_, W>
impl<W: Write> Drop for SuspendGuard<'_, W>
Auto Trait Implementations§
impl<'a, W> Freeze for SuspendGuard<'a, W>
impl<'a, W> RefUnwindSafe for SuspendGuard<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for SuspendGuard<'a, W>where
W: Send,
impl<'a, W> Sync for SuspendGuard<'a, W>where
W: Sync,
impl<'a, W> Unpin for SuspendGuard<'a, W>
impl<'a, W> UnsafeUnpin for SuspendGuard<'a, W>
impl<'a, W> !UnwindSafe for SuspendGuard<'a, W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more