pub struct TtyBackend { /* private fields */ }Expand description
Native Unix terminal backend.
Combines TtyClock, TtyEventSource, and TtyPresenter into a single
Backend implementation that the ftui runtime can drive.
When created with TtyBackend::open, the backend enters raw mode and
manages the terminal lifecycle via RAII. On drop (including panics),
all features are disabled, the cursor is shown, the alt screen is exited,
and raw mode is restored — in that order.
When created with TtyBackend::new (headless), no terminal I/O occurs.
Implementations§
Source§impl TtyBackend
impl TtyBackend
Sourcepub fn new(width: u16, height: u16) -> Self
pub fn new(width: u16, height: u16) -> Self
Create a headless backend (no terminal I/O). Useful for testing.
Sourcepub fn with_capabilities(
width: u16,
height: u16,
capabilities: TerminalCapabilities,
) -> Self
pub fn with_capabilities( width: u16, height: u16, capabilities: TerminalCapabilities, ) -> Self
Create a headless backend with explicit capabilities.
Trait Implementations§
Source§impl Backend for TtyBackend
impl Backend for TtyBackend
Source§impl BackendEventSource for TtyBackend
Allow TtyBackend to be used directly as a BackendEventSource in
Program<M, TtyBackend, W>. Delegates to the inner TtyEventSource.
This is the primary integration point: the runtime owns a TtyBackend
as its event source, which also provides RAII terminal cleanup on drop.
impl BackendEventSource for TtyBackend
Allow TtyBackend to be used directly as a BackendEventSource in
Program<M, TtyBackend, W>. Delegates to the inner TtyEventSource.
This is the primary integration point: the runtime owns a TtyBackend
as its event source, which also provides RAII terminal cleanup on drop.