pub struct TerminalRenderer { /* private fields */ }Expand description
Stateful double-buffered terminal renderer projecting a retained SceneTree into coalesced ANSI TUI diffs or zero-ANSI static CLI plain text.
Implementations§
Source§impl TerminalRenderer
Double-buffered semantic scene projection, zero-work idle short-circuit, virtualized scroll projection, and coalesced ANSI diff encoding for TerminalRenderer.
impl TerminalRenderer
Double-buffered semantic scene projection, zero-work idle short-circuit, virtualized scroll projection, and coalesced ANSI diff encoding for TerminalRenderer.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a fresh TerminalRenderer with empty diff history and DEC Mode 2026 synchronized output enabled.
§Returns
Self- Initialized terminal renderer.
Sourcepub fn with_sync_output(enabled: bool) -> Self
pub fn with_sync_output(enabled: bool) -> Self
Sourcepub fn has_previous_frame(&self) -> bool
pub fn has_previous_frame(&self) -> bool
Sourcepub const fn last_fingerprint(&self) -> Option<TerminalFrameFingerprint>
pub const fn last_fingerprint(&self) -> Option<TerminalFrameFingerprint>
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Marks the previous-frame back buffer invalid without deallocating its storage, forcing a clean full synchronization on the next interactive render.
§Arguments
&Self- Mutable terminal renderer.
Sourcepub fn render_tree(
&mut self,
tree: &SceneTree,
cols: u16,
rows: u16,
mode: TerminalRenderMode,
) -> (String, TerminalDiffStats)
pub fn render_tree( &mut self, tree: &SceneTree, cols: u16, rows: u16, mode: TerminalRenderMode, ) -> (String, TerminalDiffStats)
Projects tree into a cols x rows character grid and returns either coalesced ANSI TUI diffs (committing via zero-clone double-buffer swap) or zero-ANSI static plain text.
§Arguments
&Self- Mutable terminal renderer.&SceneTree- Retained UI scene tree to project.u16- Terminal viewport width in columns.u16- Terminal viewport height in rows.TerminalRenderMode- Interactive TUI diff mode or static plain-text CLI mode.
§Returns
(String, TerminalDiffStats)- Rendered UTF-8 terminal payload and cell-diff telemetry.
Sourcepub fn render_tree_borrowed(
&mut self,
tree: &SceneTree,
cols: u16,
rows: u16,
mode: TerminalRenderMode,
) -> (&str, TerminalDiffStats)
pub fn render_tree_borrowed( &mut self, tree: &SceneTree, cols: u16, rows: u16, mode: TerminalRenderMode, ) -> (&str, TerminalDiffStats)
Projects tree into a cols x rows character grid and returns a zero-allocation borrowed view of the encoded ANSI or plain-text payload.
§Arguments
&Self- Mutable terminal renderer.&SceneTree- Retained UI scene tree to project.u16- Terminal viewport width in columns.u16- Terminal viewport height in rows.TerminalRenderMode- Interactive TUI diff mode or static plain-text CLI mode.
§Returns
(&str, TerminalDiffStats)- Borrowed UTF-8 terminal payload and cell-diff telemetry.
Sourcepub fn render_tree_to_writer<WriterType>(
&mut self,
tree: &SceneTree,
cols: u16,
rows: u16,
mode: TerminalRenderMode,
writer: &mut WriterType,
) -> TerminalWriteResultwhere
WriterType: Write,
pub fn render_tree_to_writer<WriterType>(
&mut self,
tree: &SceneTree,
cols: u16,
rows: u16,
mode: TerminalRenderMode,
writer: &mut WriterType,
) -> TerminalWriteResultwhere
WriterType: Write,
Projects tree, encodes the batched output into an internal scratch buffer, flushes it in one write call to writer, and swaps double-buffer ownership ONLY when writing succeeds.
§Arguments
&Self- Mutable terminal renderer.&SceneTree- Retained UI scene tree to project.u16- Terminal viewport width in columns.u16- Terminal viewport height in rows.TerminalRenderMode- Interactive TUI diff mode or static plain-text CLI mode.&mut WriterType- Output writer receiving the single batched write.
§Returns
TerminalWriteResult- Write status, diff stats, and whether double-buffer ownership was swapped.
Sourcepub fn handle_key(
&mut self,
tree: &mut SceneTree,
key: KeyEvent,
) -> TerminalNavAction
pub fn handle_key( &mut self, tree: &mut SceneTree, key: KeyEvent, ) -> TerminalNavAction
Processes a terminal keyboard event (Tab, Shift+Tab, arrows, Enter, Escape, Ctrl+C) against tree.
§Arguments
&Self- Mutable terminal renderer.&mut SceneTree- Retained UI scene tree to update focus, scroll, or activation on.KeyEvent- Normalized keyboard event.
§Returns
TerminalNavAction- Resulting focus, scroll, activation, or exit action.
Sourcepub fn opts_out_of_gpu_routing(&self) -> bool
pub fn opts_out_of_gpu_routing(&self) -> bool
Explicitly signals that TUI/CLI rendering opts out of graphical GPU routing.
§Returns
bool- Alwaystrue.
Sourcepub fn record_input_received(&mut self)
pub fn record_input_received(&mut self)
Records the arrival timestamp of a terminal input event for subsequent input_to_output_ms measurement.
Sourcepub fn last_telemetry_report(&self) -> TerminalNonGpuTelemetry
pub fn last_telemetry_report(&self) -> TerminalNonGpuTelemetry
Returns the most recent non-GPU, non-Hz TUI/CLI telemetry snapshot.
§Returns
TerminalNonGpuTelemetry- Latest telemetry (input_to_output_ms,flush_latency_ms,bytes_written, backpressure).
Source§impl TerminalRenderer
Implements impl #impl_generics #name #ty_generics #where_clause.
impl TerminalRenderer
Implements impl #impl_generics #name #ty_generics #where_clause.
pub fn get_previous(&self) -> &TerminalCellGrid
pub fn get_mut_previous(&mut self) -> &mut TerminalCellGrid
pub fn set_previous(&mut self, val: TerminalCellGrid) -> &mut Self
pub fn get_previous_valid(&self) -> bool
pub fn get_mut_previous_valid(&mut self) -> &mut bool
pub fn set_previous_valid(&mut self, val: bool) -> &mut Self
pub fn get_current(&self) -> &TerminalCellGrid
pub fn get_mut_current(&mut self) -> &mut TerminalCellGrid
pub fn set_current(&mut self, val: TerminalCellGrid) -> &mut Self
pub fn get_mut_last_fingerprint( &mut self, ) -> &mut Option<TerminalFrameFingerprint>
pub fn set_last_fingerprint( &mut self, val: Option<TerminalFrameFingerprint>, ) -> &mut Self
pub fn get_tracked_scroll_nodes(&self) -> &Vec<NodeId>
pub fn get_mut_tracked_scroll_nodes(&mut self) -> &mut Vec<NodeId>
pub fn set_tracked_scroll_nodes(&mut self, val: Vec<NodeId>) -> &mut Self
pub fn get_ansi_scratch(&self) -> &String
pub fn get_mut_ansi_scratch(&mut self) -> &mut String
pub fn set_ansi_scratch(&mut self, val: String) -> &mut Self
pub fn get_last_cols(&self) -> u16
pub fn get_mut_last_cols(&mut self) -> &mut u16
pub fn set_last_cols(&mut self, val: u16) -> &mut Self
pub fn get_last_rows(&self) -> u16
pub fn get_mut_last_rows(&mut self) -> &mut u16
pub fn set_last_rows(&mut self, val: u16) -> &mut Self
pub fn get_frames_rendered(&self) -> u64
pub fn get_mut_frames_rendered(&mut self) -> &mut u64
pub fn set_frames_rendered(&mut self, val: u64) -> &mut Self
pub fn get_skipped_idle_frames(&self) -> u64
pub fn get_mut_skipped_idle_frames(&mut self) -> &mut u64
pub fn set_skipped_idle_frames(&mut self, val: u64) -> &mut Self
pub fn get_last_projected_rows(&self) -> usize
pub fn get_mut_last_projected_rows(&mut self) -> &mut usize
pub fn set_last_projected_rows(&mut self, val: usize) -> &mut Self
pub fn get_sync_output_mode(&self) -> bool
pub fn get_mut_sync_output_mode(&mut self) -> &mut bool
pub fn set_sync_output_mode(&mut self, val: bool) -> &mut Self
pub fn get_exit_requested(&self) -> bool
pub fn get_mut_exit_requested(&mut self) -> &mut bool
pub fn set_exit_requested(&mut self, val: bool) -> &mut Self
pub fn get_total_bytes_written(&self) -> u64
pub fn get_mut_total_bytes_written(&mut self) -> &mut u64
pub fn set_total_bytes_written(&mut self, val: u64) -> &mut Self
pub fn get_backpressure_events(&self) -> u64
pub fn get_mut_backpressure_events(&mut self) -> &mut u64
pub fn set_backpressure_events(&mut self, val: u64) -> &mut Self
pub fn get_batched_flush_count(&self) -> u64
pub fn get_mut_batched_flush_count(&mut self) -> &mut u64
pub fn set_batched_flush_count(&mut self, val: u64) -> &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 Clone for TerminalRenderer
impl Clone for TerminalRenderer
Source§impl Debug for TerminalRenderer
impl Debug for TerminalRenderer
Source§impl Default for TerminalRenderer
Default TerminalRenderer enabling DEC Mode 2026 synchronized frame updates for flicker-free differential TUI presentation.
impl Default for TerminalRenderer
Default TerminalRenderer enabling DEC Mode 2026 synchronized frame updates for flicker-free differential TUI presentation.