DisplayBuffer

Struct DisplayBuffer 

Source
pub struct DisplayBuffer { /* private fields */ }
Expand description
§Description

A display buffer is the buffer that holds all of the information about what characters to display to the screen

Implementations§

Source§

impl DisplayBuffer

Source

pub fn new(dimensions: Dimensions) -> Self

§Description

Creates a new display buffer with the given dimensions

§Arguments
  • dimensions: Dimensions - The dimensions of the display buffer
§Returns

DisplayBuffer - A display buffer with the specified attributes

Source

pub fn draw(&self)

§Description

Draws the buffer to the terminal

Source

pub fn get_width(&self) -> u32

§Description

Retrieves the width of the display buffer

§Returns

u32 - The width of the display buffer

Source

pub fn get_height(&self) -> u32

§Description

Retrieves the height of the display buffer

§Returns

u32 - The height of the display buffer

Source

pub fn set_char(&mut self, c: char, x: i32, y: i32)

§Description

Writes a character to the display buffer

If the coordinates are out of the bounds of the buffer, it ignores the write

§Arguments
  • c: char - The character to insert
  • x: u32 - The x position to write to
  • y: u32 - The y position to write to
Source

pub fn clear(&mut self, c: char)

§Description

Clears the display buffer to a specified character

§Arguments
  • c: char - The character to clear with

Trait Implementations§

Source§

impl Debug for DisplayBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.