pub struct Buffer {
pub size: Size,
pub cells: Vec<Cell>,
}Expand description
字符格缓冲区
Fields§
§size: Size§cells: Vec<Cell>Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn new(size: Size) -> Self
pub fn new(size: Size) -> Self
Creates a new buffer of the given size, filled with default (blank) cells.
Sourcepub fn get_mut(&mut self, x: u16, y: u16) -> Option<&mut Cell>
pub fn get_mut(&mut self, x: u16, y: u16) -> Option<&mut Cell>
Returns a mutable reference to the cell at (x, y), or None if out of bounds.
Sourcepub fn write_text(&mut self, pos: Pos, clip: Rect, text: &str, style: &Style)
pub fn write_text(&mut self, pos: Pos, clip: Rect, text: &str, style: &Style)
写入文本到缓冲区(支持宽字符)
CJK 等宽字符占 2 cell,第二格标记为 continuation。
Sourcepub fn draw_border(&mut self, rect: Rect, border: Border, style: &Style)
pub fn draw_border(&mut self, rect: Rect, border: Border, style: &Style)
在指定 rect 边框绘制边框字符
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnsafeUnpin for Buffer
impl UnwindSafe for Buffer
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