pub struct TerminalManager { /* private fields */ }Expand description
Manages the terminal lifecycle: raw mode, alternate screen, and rendering.
Guarantees terminal state restoration on drop (normal exit, error, or panic).
The panic hook installed via install_panic_hook provides an additional
safety net for restoration before the panic message is printed.
Implementations§
Source§impl TerminalManager
impl TerminalManager
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Initialize terminal: enable raw mode, switch to alternate screen, hide cursor.
This must be called before any rendering. The terminal is restored
automatically when the TerminalManager is dropped.
Sourcepub fn restore(&mut self) -> Result<()>
pub fn restore(&mut self) -> Result<()>
Restore the terminal to its original state: disable raw mode, leave alternate screen, show cursor.
Trait Implementations§
Source§impl Drop for TerminalManager
impl Drop for TerminalManager
Auto Trait Implementations§
impl Freeze for TerminalManager
impl RefUnwindSafe for TerminalManager
impl Send for TerminalManager
impl Sync for TerminalManager
impl Unpin for TerminalManager
impl UnsafeUnpin for TerminalManager
impl UnwindSafe for TerminalManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more