pub struct SinkGuard { /* private fields */ }Expand description
RAII handle that installs a custom sink and restores the prior
one on drop. The TUI uses this so stderr emission resumes after
the alt-screen exits in the normal-return path. Note: the
workspace’s release profile sets panic = "abort", so on a
release-build panic this Drop does not run — the panic
hook (in [super::tui]) is what restores the terminal under
abort, and stderr is owned by the alt-screen until then. Under
the default unwind profile (dev/test), stack unwinding drops
the guard normally.
Nested guards in nested scopes restore in reverse construction
order so long as Rust’s normal stack-LIFO drop applies (no
explicit mem::take of the field, no moves into a heap-owned
container that delays drop). Don’t move the guard into
Box/Arc/Vec and expect LIFO.