Struct rustc_errors::styled_buffer::StyledBuffer
source · [−]pub struct StyledBuffer {
lines: Vec<Vec<StyledChar>>,
}
Fields
lines: Vec<Vec<StyledChar>>
Implementations
sourceimpl StyledBuffer
impl StyledBuffer
pub fn new() -> StyledBuffer
sourcepub fn render(&self) -> Vec<Vec<StyledString>>
pub fn render(&self) -> Vec<Vec<StyledString>>
Returns content of StyledBuffer
split by lines and line styles
fn ensure_lines(&mut self, line: usize)
sourcepub fn putc(&mut self, line: usize, col: usize, chr: char, style: Style)
pub fn putc(&mut self, line: usize, col: usize, chr: char, style: Style)
Sets chr
with style
for given line
, col
.
If line
does not exist in our buffer, adds empty lines up to the given
and fills the last line with unstyled whitespace.
sourcepub fn puts(&mut self, line: usize, col: usize, string: &str, style: Style)
pub fn puts(&mut self, line: usize, col: usize, string: &str, style: Style)
Sets string
with style
for given line
, starting from col
.
If line
does not exist in our buffer, adds empty lines up to the given
and fills the last line with unstyled whitespace.
sourcepub fn prepend(&mut self, line: usize, string: &str, style: Style)
pub fn prepend(&mut self, line: usize, string: &str, style: Style)
For given line
inserts string
with style
before old content of that line,
adding lines if needed
sourcepub fn append(&mut self, line: usize, string: &str, style: Style)
pub fn append(&mut self, line: usize, string: &str, style: Style)
For given line
inserts string
with style
after old content of that line,
adding lines if needed
pub fn num_lines(&self) -> usize
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for StyledBuffer
impl Send for StyledBuffer
impl Sync for StyledBuffer
impl Unpin for StyledBuffer
impl UnwindSafe for StyledBuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes