pub struct CharCanvas { /* private fields */ }Implementations§
Source§impl CharCanvas
impl CharCanvas
pub fn new() -> Self
Sourcepub fn put(&mut self, x: i64, y: i64, char: char, style: CanvasStyle)
pub fn put(&mut self, x: i64, y: i64, char: char, style: CanvasStyle)
Place a single character, merging box-drawing connectivity.
Sourcepub fn text(&mut self, x: i64, y: i64, value: &str, style: CanvasStyle)
pub fn text(&mut self, x: i64, y: i64, value: &str, style: CanvasStyle)
Write a text run left to right in terminal display cells.
Sourcepub fn text_if_empty(
&mut self,
x: i64,
y: i64,
value: &str,
style: CanvasStyle,
) -> bool
pub fn text_if_empty( &mut self, x: i64, y: i64, value: &str, style: CanvasStyle, ) -> bool
Write text only when every target cell is empty. Returns whether the text was written.
Sourcepub fn text_over_run(
&mut self,
x: i64,
y: i64,
value: &str,
style: CanvasStyle,
) -> bool
pub fn text_over_run( &mut self, x: i64, y: i64, value: &str, style: CanvasStyle, ) -> bool
Write text over a plain horizontal run, replacing ─ cells only.
Refuses unless every target cell and both flanking cells are exactly
─. Spaces in value become real blanks on purpose.
Sourcepub fn fill_rect(
&mut self,
x: i64,
y: i64,
width: i64,
height: i64,
style: CanvasStyle,
)
pub fn fill_rect( &mut self, x: i64, y: i64, width: i64, height: i64, style: CanvasStyle, )
Fill a rectangle with intentional styled spaces. Unlike put, this
preserves spaces so node cards can carry a background color.
pub fn hline(&mut self, y: i64, x1: i64, x2: i64, style: CanvasStyle)
pub fn vline(&mut self, x: i64, y1: i64, y2: i64, style: CanvasStyle)
pub fn size(&self) -> (usize, usize)
Sourcepub fn render_runs_window(
&self,
origin_x: i64,
origin_y: i64,
width: usize,
height: usize,
) -> Vec<Vec<StyledRun>>
pub fn render_runs_window( &self, origin_x: i64, origin_y: i64, width: usize, height: usize, ) -> Vec<Vec<StyledRun>>
Materialize only the requested viewport. The complete logical scene remains in sparse cells, but large off-screen rows and columns never become strings or Ratatui spans.
Sourcepub fn render_runs(&self) -> Vec<Vec<StyledRun>>
pub fn render_runs(&self) -> Vec<Vec<StyledRun>>
Render to rows of styled runs, gaps filled with plain spaces. Trailing whitespace is trimmed from every row.
Sourcepub fn render_plain(&self) -> Vec<String>
pub fn render_plain(&self) -> Vec<String>
Render to plain text lines (trailing whitespace trimmed), matching the TypeScript renderer with colors disabled.
Trait Implementations§
Source§impl Clone for CharCanvas
impl Clone for CharCanvas
Source§fn clone(&self) -> CharCanvas
fn clone(&self) -> CharCanvas
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for CharCanvas
impl Default for CharCanvas
Source§fn default() -> CharCanvas
fn default() -> CharCanvas
Auto Trait Implementations§
impl Freeze for CharCanvas
impl RefUnwindSafe for CharCanvas
impl Send for CharCanvas
impl Sync for CharCanvas
impl Unpin for CharCanvas
impl UnsafeUnpin for CharCanvas
impl UnwindSafe for CharCanvas
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more