Skip to main content

RenderBuffer

Struct RenderBuffer 

Source
pub struct RenderBuffer {
    pub cells: Vec<Cell>,
    pub width: usize,
    pub height: usize,
}

Fields§

§cells: Vec<Cell>§width: usize§height: usize

Implementations§

Source§

impl RenderBuffer

Source

pub fn new(width: usize, height: usize, default_style: &Style) -> Self

Creates a new RenderBuffer with a default style

§Arguments
  • width: The desired width of the buffer measured in “cells”
  • height: The desired height of the buffer measured in “cells”
  • default_style: Some default style for formatting the empty cells
§Returns
  • A newly constructed RenderBuffer with a default style and no content
Source

pub fn new_with_contents( width: usize, height: usize, style: &Style, contents: Vec<String>, ) -> Self

Creates a new RenderBuffer with text

§Arguments
  • width: The desired width of the buffer measured in “cells”
  • height: The desired height of the buffer measured in “cells”
  • style: Styling to apply to the cells based on the provided content
  • contents: A vector of strings representing the buffer’s text
§Returns
  • A constructed RenderBuffer with styling and textual content
Source

pub fn clear(&mut self)

Clears the buffer by replacing all characters within the cells with whitespace

Source

pub fn set_char( &mut self, x: usize, y: usize, c: char, style: &Style, theme: &Theme, )

Add a character to a buffer cell with appropriate styling and theme

§Arguments
  • x: The x coordinate of the cell
  • y: The y coordinate of the cell
  • c: The character to emplace
  • style: The styling of the character and its encapsulating cell
  • theme: The theme to use for styling
Source

pub fn set_text(&mut self, x: usize, y: usize, text: &str, style: &Style)

Adds a string of text to the buffer with appropriate styling

§Arguments
  • x: The x coordinate representing the start of the text’s destination within the buffer
  • y: The y coordinate representing the start of the text’s destination within the buffer
  • text: The text to emplace
  • style: The styling to apply to the text on a cell-wise basis
Source

pub fn diff(&self, other: &RenderBuffer) -> Vec<Change<'_>>

Computes the differences between two RenderBuffers

§Arguments
  • other: The buffer being compared to the current buffer
§Returns
  • A vector of Changes which contains information about which positions and cells differ

Trait Implementations§

Source§

impl Clone for RenderBuffer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderBuffer

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.