pub struct TerminalGuard { /* private fields */ }Expand description
RAII terminal owner with reverse-order teardown and foreground-child handoff.
Implementations§
Source§impl TerminalGuard
impl TerminalGuard
Sourcepub fn enter(
driver: impl TerminalDriver + 'static,
options: TerminalOptions,
) -> Result<Self>
pub fn enter( driver: impl TerminalDriver + 'static, options: TerminalOptions, ) -> Result<Self>
Enables the requested modes and registers panic restoration.
§Errors
On partial initialization failure, every successfully enabled mode is disabled in reverse order before returning.
Sourcepub fn begin_frame(&self) -> Result<()>
pub fn begin_frame(&self) -> Result<()>
Starts a synchronized frame when configured.
Sourcepub fn end_frame(&self, timeout: Duration) -> Result<()>
pub fn end_frame(&self, timeout: Duration) -> Result<()>
Ends and drains a synchronized frame within a deadline.
Sourcepub fn suspend(&self, timeout: Duration) -> Result<()>
pub fn suspend(&self, timeout: Duration) -> Result<()>
Restores all modes before suspend or foreground-child ownership.
Sourcepub fn handoff<T>(
&self,
timeout: Duration,
child: impl FnOnce() -> Result<T>,
) -> Result<T>
pub fn handoff<T>( &self, timeout: Duration, child: impl FnOnce() -> Result<T>, ) -> Result<T>
Parks input, drains output, restores modes, runs a foreground child, and always attempts terminal reinitialization before returning.
Sourcepub fn enabled_modes(&self) -> Result<Vec<TerminalMode>>
pub fn enabled_modes(&self) -> Result<Vec<TerminalMode>>
Returns the enabled-mode ledger for diagnostics and tests.
Sourcepub fn input_is_parked(&self) -> Result<bool>
pub fn input_is_parked(&self) -> Result<bool>
Returns whether input is parked for a foreground owner.
Trait Implementations§
Source§impl Debug for TerminalGuard
impl Debug for TerminalGuard
Source§impl Drop for TerminalGuard
impl Drop for TerminalGuard
Auto Trait Implementations§
impl Freeze for TerminalGuard
impl RefUnwindSafe for TerminalGuard
impl Send for TerminalGuard
impl Sync for TerminalGuard
impl Unpin for TerminalGuard
impl UnsafeUnpin for TerminalGuard
impl UnwindSafe for TerminalGuard
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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