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.
§Returns
Self- Initialized terminal renderer.
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<W>(
&mut self,
tree: &SceneTree,
cols: u16,
rows: u16,
mode: TerminalRenderMode,
writer: &mut W,
) -> TerminalWriteResultwhere
W: Write,
pub fn render_tree_to_writer<W>(
&mut self,
tree: &SceneTree,
cols: u16,
rows: u16,
mode: TerminalRenderMode,
writer: &mut W,
) -> TerminalWriteResultwhere
W: 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 W- 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.