pub struct StyledBuffer<T>{ /* private fields */ }Expand description
An acceptable custom XXXStyle for StyledBuffer must implement trait Clone, PartialEq, Eq and Style.
Implementations§
Source§impl<T> StyledBuffer<T>
impl<T> StyledBuffer<T>
pub fn new() -> StyledBuffer<T>
Sourcepub fn render(&self) -> Vec<Vec<StyledString<T>>>
pub fn render(&self) -> Vec<Vec<StyledString<T>>>
Returns content of StyledBuffer split by lines and line styles
Sourcepub fn putc(&mut self, line: usize, col: usize, chr: char, style: Option<T>)
pub fn putc(&mut self, line: usize, col: usize, chr: char, style: Option<T>)
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: Option<T>)
pub fn puts(&mut self, line: usize, col: usize, string: &str, style: Option<T>)
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 pushs(&mut self, string: &str, style: Option<T>)
pub fn pushs(&mut self, string: &str, style: Option<T>)
Sets string with style for a new line, starting from col 0.
It will add an new empty line after all the buffer lines for the string.
Sourcepub fn appendl(&mut self, string: &str, style: Option<T>)
pub fn appendl(&mut self, string: &str, style: Option<T>)
For the last line inserts string with style after old content of that line,
adding a new line if the StyledBuffer has no line.
Sourcepub fn prepend(&mut self, line: usize, string: &str, style: Option<T>)
pub fn prepend(&mut self, line: usize, string: &str, style: Option<T>)
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: Option<T>)
pub fn append(&mut self, line: usize, string: &str, style: Option<T>)
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§
Source§impl<T> Debug for StyledBuffer<T>
impl<T> Debug for StyledBuffer<T>
Source§impl<T> PartialEq for StyledBuffer<T>
impl<T> PartialEq for StyledBuffer<T>
impl<T> Eq for StyledBuffer<T>
impl<T> StructuralPartialEq for StyledBuffer<T>
Auto Trait Implementations§
impl<T> Freeze for StyledBuffer<T>
impl<T> RefUnwindSafe for StyledBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for StyledBuffer<T>where
T: Send,
impl<T> Sync for StyledBuffer<T>where
T: Sync,
impl<T> Unpin for StyledBuffer<T>where
T: Unpin,
impl<T> UnwindSafe for StyledBuffer<T>where
T: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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