Struct hanbun::Buffer [−][src]
A buffer for storing the state of the cells. You can see it as a drawing canvas.
Examples
let mut buffer; if let Ok((width, height)) = hanbun::size() { buffer = hanbun::Buffer::new(width, height, ' '); } else { return; } buffer.set(3, 3); buffer.draw();
Fields
cells: Vec<Cell>
width: usize
height: usize
Implementations
impl Buffer
[src]
pub fn new(width: usize, height: usize, char: char) -> Buffer
[src]
Creates a new buffer of width * height
cells filled with char
.
pub fn draw(&mut self)
[src]
pub fn clear(&mut self, char: char)
[src]
Clears the buffer using char
.
pub fn set(&mut self, x: usize, y: usize)
[src]
pub fn color(&mut self, x: usize, y: usize, color: Color)
[src]
Colors the cell at (x
, y
) with the given color.
Panics
Panics if (x
, y
) is out of the buffer's range.
pub fn print(&mut self, x: usize, y: usize, string: &str)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Buffer
[src]
impl Send for Buffer
[src]
impl Sync for Buffer
[src]
impl Unpin for Buffer
[src]
impl UnwindSafe for Buffer
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,