pub struct GraphRenderer {
pub canvas_width: u32,
pub canvas_height: u32,
}Expand description
A simple canvas-based renderer that produces ASCII art.
Fields§
§canvas_width: u32Canvas width in character columns.
canvas_height: u32Canvas height in character rows.
Implementations§
Source§impl GraphRenderer
impl GraphRenderer
Sourcepub fn new(canvas_width: u32, canvas_height: u32) -> Self
pub fn new(canvas_width: u32, canvas_height: u32) -> Self
Creates a new renderer with the given canvas dimensions.
Sourcepub fn render_ascii(
&self,
layout: &GraphLayout,
nodes: &[(u64, String)],
) -> String
pub fn render_ascii( &self, layout: &GraphLayout, nodes: &[(u64, String)], ) -> String
Renders the layout as an ASCII art string.
Each node is represented as [name] placed at its grid position
(scaled to fit the canvas). The returned string contains
canvas_height lines separated by '\n'.
Auto Trait Implementations§
impl Freeze for GraphRenderer
impl RefUnwindSafe for GraphRenderer
impl Send for GraphRenderer
impl Sync for GraphRenderer
impl Unpin for GraphRenderer
impl UnsafeUnpin for GraphRenderer
impl UnwindSafe for GraphRenderer
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