pub struct RenderBuffer {
pub cells: Vec<Cell>,
pub width: usize,
pub height: usize,
}Fields§
§cells: Vec<Cell>§width: usize§height: usizeImplementations§
Source§impl RenderBuffer
impl RenderBuffer
Sourcepub fn new(width: usize, height: usize, default_style: &Style) -> Self
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
RenderBufferwith a default style and no content
Sourcepub fn new_with_contents(
width: usize,
height: usize,
style: &Style,
contents: Vec<String>,
) -> Self
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 contentcontents: A vector of strings representing the buffer’s text
§Returns
- A constructed
RenderBufferwith styling and textual content
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the buffer by replacing all characters within the cells with whitespace
Sourcepub fn set_char(
&mut self,
x: usize,
y: usize,
c: char,
style: &Style,
theme: &Theme,
)
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 celly: The y coordinate of the cellc: The character to emplacestyle: The styling of the character and its encapsulating celltheme: The theme to use for styling
Sourcepub fn set_text(&mut self, x: usize, y: usize, text: &str, style: &Style)
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 buffery: The y coordinate representing the start of the text’s destination within the buffertext: The text to emplacestyle: The styling to apply to the text on a cell-wise basis
Trait Implementations§
Source§impl Clone for RenderBuffer
impl Clone for RenderBuffer
Auto Trait Implementations§
impl Freeze for RenderBuffer
impl RefUnwindSafe for RenderBuffer
impl Send for RenderBuffer
impl Sync for RenderBuffer
impl Unpin for RenderBuffer
impl UnsafeUnpin for RenderBuffer
impl UnwindSafe for RenderBuffer
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