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 (labels, node lines).
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)
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 Default for CharCanvas
impl Default for CharCanvas
Source§fn default() -> CharCanvas
fn default() -> CharCanvas
Returns the “default value” for a type. Read more
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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