Struct rustc_errors::styled_buffer::StyledBuffer[−][src]

pub struct StyledBuffer {
    lines: Vec<Vec<StyledChar>>,
}

Fields

lines: Vec<Vec<StyledChar>>

Implementations

impl StyledBuffer[src]

pub fn new() -> StyledBuffer[src]

pub fn render(&self) -> Vec<Vec<StyledString>>[src]

Returns content of StyledBuffer splitted by lines and line styles

fn ensure_lines(&mut self, line: usize)[src]

pub fn putc(&mut self, line: usize, col: usize, chr: char, style: Style)[src]

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.

pub fn puts(&mut self, line: usize, col: usize, string: &str, style: Style)[src]

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.

pub fn prepend(&mut self, line: usize, string: &str, style: Style)[src]

For given line inserts string with style before old content of that line, adding lines if needed

pub fn append(&mut self, line: usize, string: &str, style: Style)[src]

For given line inserts string with style after old content of that line, adding lines if needed

pub fn num_lines(&self) -> usize[src]

pub fn set_style_range(
    &mut self,
    line: usize,
    col_start: usize,
    col_end: usize,
    style: Style,
    overwrite: bool
)
[src]

Set style for line, col_start..col_end range if:

  1. That line and column range exist in StyledBuffer
  2. overwrite is true or existing style is Style::NoStyle or Style::Quotation

pub fn set_style(
    &mut self,
    line: usize,
    col: usize,
    style: Style,
    overwrite: bool
)
[src]

Set style for line, col if:

  1. That line and column exist in StyledBuffer
  2. overwrite is true or existing style is Style::NoStyle or Style::Quotation

Trait Implementations

impl Debug for StyledBuffer[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.