pub struct Renderer { /* private fields */ }Expand description
Differential terminal renderer.
Tracks the previous frame to enable efficient redrawing. The strategy
is automatically reset to Diff after each render.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub fn render(
&mut self,
term: &mut dyn Terminal,
rendered: &Rendered,
) -> Result<()>
pub fn render( &mut self, term: &mut dyn Terminal, rendered: &Rendered, ) -> Result<()>
Write the rendered output to the terminal using the current strategy.
This implementation closely follows the original TypeScript TUI renderer:
- FirstRender: outputs all lines without clearing (assumes clean alternate screen).
- FullRedraw: clears screen + scrollback, then outputs all lines.
- Diff: computes first/last changed line, moves cursor there, and only
rewrites the changed region using
\x1b[2Kper line.
Source§impl Renderer
impl Renderer
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new renderer with no previous frame and
FirstRender strategy.
Sourcepub fn set_strategy(&mut self, strategy: RenderStrategy)
pub fn set_strategy(&mut self, strategy: RenderStrategy)
Override the strategy for the next render call.
Auto Trait Implementations§
impl Freeze for Renderer
impl RefUnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl UnsafeUnpin for Renderer
impl UnwindSafe for Renderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more