pub struct StyledBuf {
pub content: String,
/* private fields */
}Expand description
Text to be rendered by painter styles has a style for each character in content
Fields§
§content: StringImplementations§
Source§impl StyledBuf
impl StyledBuf
pub fn empty() -> Self
pub fn new(content: &str) -> Self
pub fn push(&mut self, content: &str, style: ContentStyle)
pub fn lines(&self) -> Vec<Vec<StyledContent<String>>>
pub fn spans(&self) -> Vec<StyledContent<String>>
pub fn count_newlines(&self) -> u16
Sourcepub fn content_len(&self) -> u16
pub fn content_len(&self) -> u16
Length of content in characters
The length returned is the ‘visual’ length of the character, in other words, how many terminal columns it takes up
pub fn apply_style(&mut self, style: ContentStyle)
pub fn apply_style_at(&mut self, index: usize, style: ContentStyle)
pub fn apply_style_in_range(&mut self, range: Range<usize>, style: ContentStyle)
pub fn slice_from(&self, start: usize) -> StyledBuf
pub fn push_buf(&mut self, buf: StyledBuf)
pub fn with(self, color: Color) -> StyledBuf
pub fn on(self, color: Color) -> StyledBuf
pub fn underline(self, color: Color) -> StyledBuf
pub fn attribute(self, attr: Attribute) -> StyledBuf
pub fn style(self, style: ContentStyle) -> StyledBuf
pub fn reset(self) -> StyledBuf
pub fn bold(self) -> StyledBuf
pub fn underlined(self) -> StyledBuf
pub fn reverse(self) -> StyledBuf
pub fn dim(self) -> StyledBuf
pub fn italic(self) -> StyledBuf
pub fn negative(self) -> StyledBuf
pub fn slow_blink(self) -> StyledBuf
pub fn rapid_blink(self) -> StyledBuf
pub fn crossed_out(self) -> StyledBuf
pub fn black(self) -> StyledBuf
pub fn on_black(self) -> StyledBuf
pub fn underline_black(self) -> StyledBuf
pub fn dark_grey(self) -> StyledBuf
pub fn on_dark_grey(self) -> StyledBuf
pub fn underline_dark_grey(self) -> StyledBuf
pub fn red(self) -> StyledBuf
pub fn on_red(self) -> StyledBuf
pub fn underline_red(self) -> StyledBuf
pub fn dark_red(self) -> StyledBuf
pub fn on_dark_red(self) -> StyledBuf
pub fn underline_dark_red(self) -> StyledBuf
pub fn green(self) -> StyledBuf
pub fn on_green(self) -> StyledBuf
pub fn underline_green(self) -> StyledBuf
pub fn dark_green(self) -> StyledBuf
pub fn on_dark_green(self) -> StyledBuf
pub fn underline_dark_green(self) -> StyledBuf
pub fn yellow(self) -> StyledBuf
pub fn on_yellow(self) -> StyledBuf
pub fn underline_yellow(self) -> StyledBuf
pub fn dark_yellow(self) -> StyledBuf
pub fn on_dark_yellow(self) -> StyledBuf
pub fn underline_dark_yellow(self) -> StyledBuf
pub fn blue(self) -> StyledBuf
pub fn on_blue(self) -> StyledBuf
pub fn underline_blue(self) -> StyledBuf
pub fn dark_blue(self) -> StyledBuf
pub fn on_dark_blue(self) -> StyledBuf
pub fn underline_dark_blue(self) -> StyledBuf
pub fn magenta(self) -> StyledBuf
pub fn on_magenta(self) -> StyledBuf
pub fn underline_magenta(self) -> StyledBuf
pub fn dark_magenta(self) -> StyledBuf
pub fn on_dark_magenta(self) -> StyledBuf
pub fn underline_dark_magenta(self) -> StyledBuf
pub fn cyan(self) -> StyledBuf
pub fn on_cyan(self) -> StyledBuf
pub fn underline_cyan(self) -> StyledBuf
pub fn dark_cyan(self) -> StyledBuf
pub fn on_dark_cyan(self) -> StyledBuf
pub fn underline_dark_cyan(self) -> StyledBuf
pub fn white(self) -> StyledBuf
pub fn on_white(self) -> StyledBuf
pub fn underline_white(self) -> StyledBuf
pub fn grey(self) -> StyledBuf
pub fn on_grey(self) -> StyledBuf
pub fn underline_grey(self) -> StyledBuf
Trait Implementations§
Source§impl<T: Display> From<Option<StyledContent<T>>> for StyledBuf
impl<T: Display> From<Option<StyledContent<T>>> for StyledBuf
Source§fn from(value: Option<StyledContent<T>>) -> Self
fn from(value: Option<StyledContent<T>>) -> Self
Converts to this type from the input type.
Source§impl<T: Display, E> From<Result<StyledContent<T>, E>> for StyledBuf
impl<T: Display, E> From<Result<StyledContent<T>, E>> for StyledBuf
Source§fn from(value: Result<StyledContent<T>, E>) -> Self
fn from(value: Result<StyledContent<T>, E>) -> Self
Converts to this type from the input type.
Source§impl<T: Display> From<StyledContent<T>> for StyledBuf
impl<T: Display> From<StyledContent<T>> for StyledBuf
Source§fn from(value: StyledContent<T>) -> Self
fn from(value: StyledContent<T>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StyledBuf
impl RefUnwindSafe for StyledBuf
impl Send for StyledBuf
impl Sync for StyledBuf
impl Unpin for StyledBuf
impl UnwindSafe for StyledBuf
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