Skip to main content

TerminalRenderer

Struct TerminalRenderer 

Source
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.

Source

pub fn new() -> Self

Creates a fresh TerminalRenderer with empty diff history.

§Returns
  • Self - Initialized terminal renderer.
Source

pub fn has_previous_frame(&self) -> bool

Returns true when the persistent previous-frame back buffer has been allocated and holds a committed interactive frame.

§Arguments
  • &Self - Terminal renderer reference.
§Returns
  • bool - true iff a committed previous grid exists (always false in StaticPlainText-only runs).
Source

pub const fn last_fingerprint(&self) -> Option<TerminalFrameFingerprint>

Returns the last committed frame fingerprint used for O(1) idle short-circuiting.

§Arguments
  • &Self - Terminal renderer reference.
§Returns
  • Option<TerminalFrameFingerprint> - Cached frame fingerprint if valid.
Source

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.
Source

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.
Source

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.
Source

pub fn render_tree_to_writer<W>( &mut self, tree: &SceneTree, cols: u16, rows: u16, mode: TerminalRenderMode, writer: &mut W, ) -> TerminalWriteResult
where 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.
Source

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.
Source§

impl TerminalRenderer

Source

pub fn get_previous(&self) -> &TerminalCellGrid

Source

pub fn get_mut_previous(&mut self) -> &mut TerminalCellGrid

Source

pub fn set_previous(&mut self, val: TerminalCellGrid) -> &mut Self

Source

pub fn get_previous_valid(&self) -> bool

Source

pub fn get_mut_previous_valid(&mut self) -> &mut bool

Source

pub fn set_previous_valid(&mut self, val: bool) -> &mut Self

Source

pub fn get_current(&self) -> &TerminalCellGrid

Source

pub fn get_mut_current(&mut self) -> &mut TerminalCellGrid

Source

pub fn set_current(&mut self, val: TerminalCellGrid) -> &mut Self

Source

pub fn get_mut_last_fingerprint( &mut self, ) -> &mut Option<TerminalFrameFingerprint>

Source

pub fn set_last_fingerprint( &mut self, val: Option<TerminalFrameFingerprint>, ) -> &mut Self

Source

pub fn get_tracked_scroll_nodes(&self) -> &Vec<NodeId>

Source

pub fn get_mut_tracked_scroll_nodes(&mut self) -> &mut Vec<NodeId>

Source

pub fn set_tracked_scroll_nodes(&mut self, val: Vec<NodeId>) -> &mut Self

Source

pub fn get_ansi_scratch(&self) -> &String

Source

pub fn get_mut_ansi_scratch(&mut self) -> &mut String

Source

pub fn set_ansi_scratch(&mut self, val: String) -> &mut Self

Source

pub fn get_last_cols(&self) -> u16

Source

pub fn get_mut_last_cols(&mut self) -> &mut u16

Source

pub fn set_last_cols(&mut self, val: u16) -> &mut Self

Source

pub fn get_last_rows(&self) -> u16

Source

pub fn get_mut_last_rows(&mut self) -> &mut u16

Source

pub fn set_last_rows(&mut self, val: u16) -> &mut Self

Source

pub fn get_frames_rendered(&self) -> u64

Source

pub fn get_mut_frames_rendered(&mut self) -> &mut u64

Source

pub fn set_frames_rendered(&mut self, val: u64) -> &mut Self

Source

pub fn get_skipped_idle_frames(&self) -> u64

Source

pub fn get_mut_skipped_idle_frames(&mut self) -> &mut u64

Source

pub fn set_skipped_idle_frames(&mut self, val: u64) -> &mut Self

Source

pub fn get_last_projected_rows(&self) -> usize

Source

pub fn get_mut_last_projected_rows(&mut self) -> &mut usize

Source

pub fn set_last_projected_rows(&mut self, val: usize) -> &mut Self

Source

pub fn get_sync_output_mode(&self) -> bool

Source

pub fn get_mut_sync_output_mode(&mut self) -> &mut bool

Source

pub fn set_sync_output_mode(&mut self, val: bool) -> &mut Self

Source

pub fn get_exit_requested(&self) -> bool

Source

pub fn get_mut_exit_requested(&mut self) -> &mut bool

Source

pub fn set_exit_requested(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Clone for TerminalRenderer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TerminalRenderer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TerminalRenderer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TerminalRenderer

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TerminalRenderer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.