Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer { /* private fields */ }
Expand description

Renders cell changes into ANSI escape sequences.

Implementations§

Source§

impl Renderer

Source

pub fn new(color_support: ColorSupport, synchronized_output: bool) -> Self

Create a new renderer with the given color support level.

Source

pub fn render(&self, changes: &[CellChange]) -> String

Render a set of cell changes into a string of ANSI escape sequences.

Source

pub fn render_batched(&self, changes: &[CellChange]) -> String

Render cell changes using batched output for fewer escape sequences.

Groups consecutive same-row cells into DeltaBatches, then renders each batch with a single cursor-move and minimal style transitions. This can produce shorter output than render when many adjacent cells change.

Source

pub fn render_optimized(&self, changes: &[CellChange]) -> String

Render cell changes with cursor hidden and combined SGR sequences.

This variant wraps the output with cursor-hide (\x1b[?25l) at the start and cursor-show (\x1b[?25h) at the end, which prevents cursor flicker during rendering. Style attributes are emitted as combined SGR sequences (e.g. \x1b[1;3;31m instead of separate codes).

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.