pub struct Buffer { /* private fields */ }Expand description
A buffer holding the terminal state
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn put_str(&mut self, x: u16, y: u16, s: &str) -> u16
pub fn put_str(&mut self, x: u16, y: u16, s: &str) -> u16
Put a string at position, handling wide characters correctly
Sourcepub fn put_str_styled(
&mut self,
x: u16,
y: u16,
s: &str,
fg: Option<Color>,
bg: Option<Color>,
) -> u16
pub fn put_str_styled( &mut self, x: u16, y: u16, s: &str, fg: Option<Color>, bg: Option<Color>, ) -> u16
Put a styled string at position
Sourcepub fn fill(&mut self, x: u16, y: u16, width: u16, height: u16, cell: Cell)
pub fn fill(&mut self, x: u16, y: u16, width: u16, height: u16, cell: Cell)
Fill a rectangular area with a cell
Sourcepub fn fill_char(&mut self, x: u16, y: u16, width: u16, height: u16, ch: char)
pub fn fill_char(&mut self, x: u16, y: u16, width: u16, height: u16, ch: char)
Fill area with a character
Sourcepub fn resize(&mut self, width: u16, height: u16)
pub fn resize(&mut self, width: u16, height: u16)
Resize the buffer, keeping content where possible
Sourcepub fn iter_cells(&self) -> impl Iterator<Item = (u16, u16, &Cell)>
pub fn iter_cells(&self) -> impl Iterator<Item = (u16, u16, &Cell)>
Iterate over cells with positions
Sourcepub fn register_hyperlink(&mut self, url: impl Into<String>) -> u16
pub fn register_hyperlink(&mut self, url: impl Into<String>) -> u16
Register a hyperlink URL and return its ID
Sourcepub fn get_hyperlink(&self, id: u16) -> Option<&str>
pub fn get_hyperlink(&self, id: u16) -> Option<&str>
Get hyperlink URL by ID
Sourcepub fn hyperlinks(&self) -> &[String]
pub fn hyperlinks(&self) -> &[String]
Get all registered hyperlinks
Sourcepub fn clear_hyperlinks(&mut self)
pub fn clear_hyperlinks(&mut self)
Clear hyperlinks (call on buffer clear/resize)
Sourcepub fn put_hyperlink(
&mut self,
x: u16,
y: u16,
text: &str,
url: &str,
fg: Option<Color>,
bg: Option<Color>,
) -> u16
pub fn put_hyperlink( &mut self, x: u16, y: u16, text: &str, url: &str, fg: Option<Color>, bg: Option<Color>, ) -> u16
Put a hyperlinked string at position
Sourcepub fn register_sequence(&mut self, seq: impl Into<String>) -> u16
pub fn register_sequence(&mut self, seq: impl Into<String>) -> u16
Register an escape sequence and return its ID
Used for raw terminal sequences like OSC 66 (text sizing). The sequence will be written directly to the terminal instead of the cell’s symbol.
Sourcepub fn get_sequence(&self, id: u16) -> Option<&str>
pub fn get_sequence(&self, id: u16) -> Option<&str>
Get escape sequence by ID
Sourcepub fn clear_sequences(&mut self)
pub fn clear_sequences(&mut self)
Clear sequences (call on buffer clear/resize)
Sourcepub fn put_sequence(
&mut self,
x: u16,
y: u16,
seq: &str,
width: u16,
height: u16,
)
pub fn put_sequence( &mut self, x: u16, y: u16, seq: &str, width: u16, height: u16, )
Put an escape sequence at position, marking subsequent cells as continuations
§Arguments
x,y- Starting positionseq- The escape sequence to writewidth- Number of cells this sequence spans (for continuation markers)height- Number of rows this sequence spans
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more