Struct ascii_renderer::char_buffer::CharBuffer
source · Expand description
The buffer used by the runner and mutated by the logic struct. Just a wrapper around a 2D char vector.
Example
let mut buf = CharBuffer::new(3, 3);
buf.set_char(0, 0, 'n').unwrap();
buf.set_char(2, 1, 'x').unwrap();
buf.set_char(2, 2, 'z').unwrap();
assert_eq!(&buf.to_string(), "n \n x \n z \n");Fields§
§data: Vec<Vec<char>>§dimensions: (usize, usize)Implementations§
source§impl CharBuffer
impl CharBuffer
source§impl CharBuffer
impl CharBuffer
sourcepub fn draw_lines(&mut self, lines: Vec<Line>)
pub fn draw_lines(&mut self, lines: Vec<Line>)
Draws lines to the buffer. The first lines in the vector will be drawn first.
Example
let mut buf = CharBuffer::new(10, 10);
let lines = vec![
Line {
char: '+',
points: (vec2!(2.0, 2.0), vec2!(8.0, 8.0)),
},
Line {
char: '=',
points: (vec2!(2.0, 8.0), vec2!(8.0, 2.0)),
},
];
buf.draw_lines(lines);
println!("{buf}");Trait Implementations§
source§impl Clone for CharBuffer
impl Clone for CharBuffer
source§fn clone(&self) -> CharBuffer
fn clone(&self) -> CharBuffer
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for CharBuffer
impl Debug for CharBuffer
source§impl Display for CharBuffer
impl Display for CharBuffer
source§impl PartialEq<CharBuffer> for CharBuffer
impl PartialEq<CharBuffer> for CharBuffer
source§fn eq(&self, other: &CharBuffer) -> bool
fn eq(&self, other: &CharBuffer) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd<CharBuffer> for CharBuffer
impl PartialOrd<CharBuffer> for CharBuffer
source§fn partial_cmp(&self, other: &CharBuffer) -> Option<Ordering>
fn partial_cmp(&self, other: &CharBuffer) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more