pub struct TerminalPlatform { /* private fields */ }Expand description
Cross-platform Terminal TUI and Static/Pipe CLI host implementing PlatformBackend and PlatformHostAdapter.
Implementations§
Source§impl TerminalPlatform
Mode builders, PTY input injection, resize sync, and CLI stdout/stderr helpers for TerminalPlatform.
impl TerminalPlatform
Mode builders, PTY input injection, resize sync, and CLI stdout/stderr helpers for TerminalPlatform.
Sourcepub fn with_mode(mode: TerminalHostMode) -> Self
pub fn with_mode(mode: TerminalHostMode) -> Self
Sourcepub fn interactive(cols: u16, rows: u16) -> Self
pub fn interactive(cols: u16, rows: u16) -> Self
Sourcepub fn static_cli(stdout_is_tty: bool, no_color: bool) -> Self
pub fn static_cli(stdout_is_tty: bool, no_color: bool) -> Self
Sourcepub fn from_probe(mode: TerminalHostMode, probe: TerminalTtyProbe) -> Self
pub fn from_probe(mode: TerminalHostMode, probe: TerminalTtyProbe) -> Self
Sourcepub fn enter_live_tui_session(&mut self)
pub fn enter_live_tui_session(&mut self)
Enters live interactive PTY raw mode and attaches the RAII restoration guard to this backend.
§Arguments
&Self- Mutable terminal platform backend.
Sourcepub fn enter_captured_tui_session(&mut self, sink: Rc<RefCell<String>>)
pub fn enter_captured_tui_session(&mut self, sink: Rc<RefCell<String>>)
Attaches a deterministic captured RAII guard for testing raw-mode entry and restore without touching real TTY handles.
§Arguments
&Self- Mutable terminal platform backend.Rc<RefCell<String>>- Sink capturing enter/exit ANSI sequences.
Sourcepub fn leave_tui_session(&mut self)
pub fn leave_tui_session(&mut self)
Explicitly restores and releases the active RAII terminal raw-mode guard, if entered.
§Arguments
&Self- Mutable terminal platform backend.
Sourcepub fn primary_window_id(&self) -> Option<WindowId>
pub fn primary_window_id(&self) -> Option<WindowId>
Sourcepub fn push_raw_input(&mut self, bytes: &[u8]) -> usize
pub fn push_raw_input(&mut self, bytes: &[u8]) -> usize
Sourcepub fn handle_terminal_resize(&mut self, cols: u16, rows: u16)
pub fn handle_terminal_resize(&mut self, cols: u16, rows: u16)
Updates terminal (cols, rows) and emits matching WindowEvent::Resized and SystemEvent::Resize events.
§Arguments
&Self- Mutable terminal platform.u16- New terminal column count.u16- New terminal row count.
Sourcepub fn write_stdout(&mut self, text: &str) -> Result<(), PlatformError>
pub fn write_stdout(&mut self, text: &str) -> Result<(), PlatformError>
Sourcepub fn write_stderr(&mut self, text: &str) -> Result<(), PlatformError>
pub fn write_stderr(&mut self, text: &str) -> Result<(), PlatformError>
Sourcepub fn present_terminal_output(
&mut self,
id: WindowId,
output: &str,
) -> Result<(), PlatformError>
pub fn present_terminal_output( &mut self, id: WindowId, output: &str, ) -> Result<(), PlatformError>
Sourcepub fn stdout_text(&self) -> String
pub fn stdout_text(&self) -> String
Sourcepub fn stderr_text(&self) -> String
pub fn stderr_text(&self) -> String
Sourcepub fn request_exit_with_code(&mut self, code: i32)
pub fn request_exit_with_code(&mut self, code: i32)
Marks the session as exiting with code and enqueues SystemEvent::Terminate.
§Arguments
&Self- Mutable terminal platform.i32- Process exit code to propagate.
Sourcepub fn render_mode(&self) -> TerminalRenderMode
pub fn render_mode(&self) -> TerminalRenderMode
Source§impl TerminalPlatform
Explicit non-GPU routing contract and batched CLI output with backpressure telemetry for TerminalPlatform.
impl TerminalPlatform
Explicit non-GPU routing contract and batched CLI output with backpressure telemetry for TerminalPlatform.
Sourcepub fn opts_out_of_gpu_routing(&self) -> bool
pub fn opts_out_of_gpu_routing(&self) -> bool
Explicitly signals that TUI and CLI hosts opt out of graphical GPU routing and screen-Hz pacing.
§Returns
bool- Alwaystrue.
Sourcepub fn telemetry_report(&self) -> TerminalNonGpuTelemetry
pub fn telemetry_report(&self) -> TerminalNonGpuTelemetry
Returns the most recent non-GPU, non-Hz terminal telemetry report (input_to_output_ms, flush_latency_ms, bytes_written).
§Returns
TerminalNonGpuTelemetry- Latest terminal telemetry snapshot.
Sourcepub fn write_stdout_batched(
&mut self,
chunks: &[&str],
) -> Result<TerminalNonGpuTelemetry, PlatformError>
pub fn write_stdout_batched( &mut self, chunks: &[&str], ) -> Result<TerminalNonGpuTelemetry, PlatformError>
Writes chunks to stdout as bounded coalesced batches respecting cli_batch_limit_bytes and backpressure, updating non-Hz telemetry.
§Arguments
&[&str]- Ordered UTF-8 CLI output chunks to coalesce and flush.
§Returns
Result<TerminalNonGpuTelemetry, PlatformError>- Updated non-GPU telemetry on success, orErron broken pipe.
Source§impl TerminalPlatform
impl TerminalPlatform
pub fn get_requested_mode(&self) -> TerminalHostMode
pub fn get_mut_requested_mode(&mut self) -> &mut TerminalHostMode
pub fn set_requested_mode(&mut self, val: TerminalHostMode) -> &mut Self
pub fn get_resolved_mode(&self) -> TerminalHostMode
pub fn get_mut_resolved_mode(&mut self) -> &mut TerminalHostMode
pub fn set_resolved_mode(&mut self, val: TerminalHostMode) -> &mut Self
pub fn get_probe(&self) -> TerminalTtyProbe
pub fn get_mut_probe(&mut self) -> &mut TerminalTtyProbe
pub fn set_probe(&mut self, val: TerminalTtyProbe) -> &mut Self
pub fn get_metrics(&self) -> TerminalCellMetrics
pub fn get_mut_metrics(&mut self) -> &mut TerminalCellMetrics
pub fn set_metrics(&mut self, val: TerminalCellMetrics) -> &mut Self
pub fn get_mut_primary_window(&mut self) -> &mut Option<WindowId>
pub fn set_primary_window(&mut self, val: Option<WindowId>) -> &mut Self
pub fn get_windows(&self) -> &HashMap<WindowId, TerminalWindowRecord>
pub fn get_mut_windows( &mut self, ) -> &mut HashMap<WindowId, TerminalWindowRecord>
pub fn set_windows( &mut self, val: HashMap<WindowId, TerminalWindowRecord>, ) -> &mut Self
pub fn get_pending_events(&self) -> &Vec<WindowEvent>
pub fn get_mut_pending_events(&mut self) -> &mut Vec<WindowEvent>
pub fn set_pending_events(&mut self, val: Vec<WindowEvent>) -> &mut Self
pub fn get_parser(&self) -> &TerminalInputParser
pub fn get_mut_parser(&mut self) -> &mut TerminalInputParser
pub fn set_parser(&mut self, val: TerminalInputParser) -> &mut Self
pub fn get_mut_raw_guard(&mut self) -> &mut Option<TerminalRawGuard>
pub fn set_raw_guard(&mut self, val: Option<TerminalRawGuard>) -> &mut Self
pub fn get_stdout_log(&self) -> &Vec<u8> ⓘ
pub fn get_mut_stdout_log(&mut self) -> &mut Vec<u8> ⓘ
pub fn set_stdout_log(&mut self, val: Vec<u8>) -> &mut Self
pub fn get_stderr_log(&self) -> &Vec<u8> ⓘ
pub fn get_mut_stderr_log(&mut self) -> &mut Vec<u8> ⓘ
pub fn set_stderr_log(&mut self, val: Vec<u8>) -> &mut Self
pub fn get_emit_os_streams(&self) -> bool
pub fn get_mut_emit_os_streams(&mut self) -> &mut bool
pub fn set_emit_os_streams(&mut self, val: bool) -> &mut Self
pub fn get_exit_code(&self) -> i32
pub fn get_mut_exit_code(&mut self) -> &mut i32
pub fn set_exit_code(&mut self, val: i32) -> &mut Self
pub fn get_broken_pipe(&self) -> bool
pub fn get_mut_broken_pipe(&mut self) -> &mut bool
pub fn set_broken_pipe(&mut self, val: bool) -> &mut Self
pub fn get_mut_clipboard(&mut self) -> &mut Option<String>
pub fn set_clipboard(&mut self, val: Option<String>) -> &mut Self
pub fn get_storage(&self) -> &HashMap<String, String>
pub fn get_mut_storage(&mut self) -> &mut HashMap<String, String>
pub fn set_storage(&mut self, val: HashMap<String, String>) -> &mut Self
pub fn get_route_stack(&self) -> &Vec<String>
pub fn get_mut_route_stack(&mut self) -> &mut Vec<String>
pub fn set_route_stack(&mut self, val: Vec<String>) -> &mut Self
pub fn get_theme(&self) -> ThemeMode
pub fn get_mut_theme(&mut self) -> &mut ThemeMode
pub fn set_theme(&mut self, val: ThemeMode) -> &mut Self
pub fn get_pump_paused(&self) -> bool
pub fn get_mut_pump_paused(&mut self) -> &mut bool
pub fn set_pump_paused(&mut self, val: bool) -> &mut Self
pub fn get_cli_batch_limit_bytes(&self) -> usize
pub fn get_mut_cli_batch_limit_bytes(&mut self) -> &mut usize
pub fn set_cli_batch_limit_bytes(&mut self, val: usize) -> &mut Self
pub fn get_last_telemetry(&self) -> TerminalNonGpuTelemetry
pub fn get_mut_last_telemetry(&mut self) -> &mut TerminalNonGpuTelemetry
pub fn set_last_telemetry(&mut self, val: TerminalNonGpuTelemetry) -> &mut Self
Trait Implementations§
Source§impl Debug for TerminalPlatform
impl Debug for TerminalPlatform
Source§impl Default for TerminalPlatform
Default TerminalPlatform auto-probing the host process TTY state.
impl Default for TerminalPlatform
Default TerminalPlatform auto-probing the host process TTY state.
Source§impl PlatformBackend for TerminalPlatform
PlatformBackend implementation for TerminalPlatform.
impl PlatformBackend for TerminalPlatform
PlatformBackend implementation for TerminalPlatform.
Source§fn kind(&self) -> PlatformKind
fn kind(&self) -> PlatformKind
Source§fn capabilities(&self) -> PlatformCapabilities
fn capabilities(&self) -> PlatformCapabilities
Source§fn create_window(
&mut self,
config: &WindowConfig,
) -> Result<WindowState, PlatformError>
fn create_window( &mut self, config: &WindowConfig, ) -> Result<WindowState, PlatformError>
Source§fn window_state(&self, id: WindowId) -> Option<WindowState>
fn window_state(&self, id: WindowId) -> Option<WindowState>
Source§fn raw_window_handle(&self, _id: WindowId) -> RawWindowHandle
fn raw_window_handle(&self, _id: WindowId) -> RawWindowHandle
Source§fn poll_events(&mut self) -> Vec<WindowEvent>
fn poll_events(&mut self) -> Vec<WindowEvent>
Source§fn set_frame_pump_paused(&mut self, paused: bool)
fn set_frame_pump_paused(&mut self, paused: bool)
Updates frame pump pause state for suspend/background freeze.
§Arguments
&Self- Mutable terminal platform.bool-trueto pause frame pumping.
Source§fn is_frame_pump_paused(&self) -> bool
fn is_frame_pump_paused(&self) -> bool
Source§fn present_framebuffer(
&mut self,
id: WindowId,
framebuffer: &Framebuffer,
) -> Result<(), PlatformError>
fn present_framebuffer( &mut self, id: WindowId, framebuffer: &Framebuffer, ) -> Result<(), PlatformError>
Source§fn read_clipboard(&self) -> Option<String>
fn read_clipboard(&self) -> Option<String>
Source§fn write_clipboard(&mut self, text: &str) -> Result<(), PlatformError>
fn write_clipboard(&mut self, text: &str) -> Result<(), PlatformError>
Source§fn system_theme(&self) -> ThemeMode
fn system_theme(&self) -> ThemeMode
Source§fn wait_for_events(&mut self) -> Vec<WindowEvent>
fn wait_for_events(&mut self) -> Vec<WindowEvent>
Source§fn present_framebuffer_region(
&mut self,
id: WindowId,
framebuffer: &Framebuffer,
_damage: DamageRegion,
) -> Result<(), PlatformError>
fn present_framebuffer_region( &mut self, id: WindowId, framebuffer: &Framebuffer, _damage: DamageRegion, ) -> Result<(), PlatformError>
Framebuffer when supported by the backend. Read moreSource§fn display_refresh_rate_hz(&self) -> f32
fn display_refresh_rate_hz(&self) -> f32
60.0 fallback). Read moreSource§impl PlatformHostAdapter for TerminalPlatform
PlatformHostAdapter implementation for TerminalPlatform.
impl PlatformHostAdapter for TerminalPlatform
PlatformHostAdapter implementation for TerminalPlatform.
Source§fn device_form_factor(&self) -> DeviceFormFactor
fn device_form_factor(&self) -> DeviceFormFactor
Source§impl PlatformLifecycleBridge for TerminalPlatform
PlatformLifecycleBridge implementation for TerminalPlatform.
impl PlatformLifecycleBridge for TerminalPlatform
PlatformLifecycleBridge implementation for TerminalPlatform.
Source§fn freeze_surface(&mut self) -> Vec<WindowEvent>
fn freeze_surface(&mut self) -> Vec<WindowEvent>
Source§fn resume_surface(&mut self) -> Vec<WindowEvent>
fn resume_surface(&mut self) -> Vec<WindowEvent>
Source§fn destroy_surface(&mut self) -> Vec<WindowEvent>
fn destroy_surface(&mut self) -> Vec<WindowEvent>
Source§impl PlatformStorage for TerminalPlatform
PlatformStorage implementation for TerminalPlatform.
impl PlatformStorage for TerminalPlatform
PlatformStorage implementation for TerminalPlatform.
Source§fn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>
fn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>
Source§fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>
fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>
Source§fn storage_clear(&mut self) -> Result<(), PlatformError>
fn storage_clear(&mut self) -> Result<(), PlatformError>
Source§impl WindowController for TerminalPlatform
WindowController implementation for TerminalPlatform.
impl WindowController for TerminalPlatform
WindowController implementation for TerminalPlatform.