StyledBuf

Struct StyledBuf 

Source
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: String

Implementations§

Source§

impl StyledBuf

Source

pub fn empty() -> Self

Source

pub fn new(content: &str) -> Self

Source

pub fn push(&mut self, content: &str, style: ContentStyle)

Source

pub fn lines(&self) -> Vec<Vec<StyledContent<String>>>

Source

pub fn spans(&self) -> Vec<StyledContent<String>>

Source

pub fn count_newlines(&self) -> u16

Source

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

Source

pub fn apply_style(&mut self, style: ContentStyle)

Source

pub fn apply_style_at(&mut self, index: usize, style: ContentStyle)

Source

pub fn apply_style_in_range(&mut self, range: Range<usize>, style: ContentStyle)

Source

pub fn slice_from(&self, start: usize) -> StyledBuf

Source

pub fn push_buf(&mut self, buf: StyledBuf)

Source

pub fn with(self, color: Color) -> StyledBuf

Source

pub fn on(self, color: Color) -> StyledBuf

Source

pub fn underline(self, color: Color) -> StyledBuf

Source

pub fn attribute(self, attr: Attribute) -> StyledBuf

Source

pub fn style(self, style: ContentStyle) -> StyledBuf

Source

pub fn reset(self) -> StyledBuf

Source

pub fn bold(self) -> StyledBuf

Source

pub fn underlined(self) -> StyledBuf

Source

pub fn reverse(self) -> StyledBuf

Source

pub fn dim(self) -> StyledBuf

Source

pub fn italic(self) -> StyledBuf

Source

pub fn negative(self) -> StyledBuf

Source

pub fn hidden(self) -> StyledBuf

Source

pub fn crossed_out(self) -> StyledBuf

Source

pub fn black(self) -> StyledBuf

Source

pub fn on_black(self) -> StyledBuf

Source

pub fn underline_black(self) -> StyledBuf

Source

pub fn dark_grey(self) -> StyledBuf

Source

pub fn on_dark_grey(self) -> StyledBuf

Source

pub fn underline_dark_grey(self) -> StyledBuf

Source

pub fn red(self) -> StyledBuf

Source

pub fn on_red(self) -> StyledBuf

Source

pub fn underline_red(self) -> StyledBuf

Source

pub fn dark_red(self) -> StyledBuf

Source

pub fn on_dark_red(self) -> StyledBuf

Source

pub fn underline_dark_red(self) -> StyledBuf

Source

pub fn green(self) -> StyledBuf

Source

pub fn on_green(self) -> StyledBuf

Source

pub fn underline_green(self) -> StyledBuf

Source

pub fn dark_green(self) -> StyledBuf

Source

pub fn on_dark_green(self) -> StyledBuf

Source

pub fn underline_dark_green(self) -> StyledBuf

Source

pub fn yellow(self) -> StyledBuf

Source

pub fn on_yellow(self) -> StyledBuf

Source

pub fn underline_yellow(self) -> StyledBuf

Source

pub fn dark_yellow(self) -> StyledBuf

Source

pub fn on_dark_yellow(self) -> StyledBuf

Source

pub fn underline_dark_yellow(self) -> StyledBuf

Source

pub fn blue(self) -> StyledBuf

Source

pub fn on_blue(self) -> StyledBuf

Source

pub fn underline_blue(self) -> StyledBuf

Source

pub fn dark_blue(self) -> StyledBuf

Source

pub fn on_dark_blue(self) -> StyledBuf

Source

pub fn underline_dark_blue(self) -> StyledBuf

Source

pub fn magenta(self) -> StyledBuf

Source

pub fn on_magenta(self) -> StyledBuf

Source

pub fn underline_magenta(self) -> StyledBuf

Source

pub fn dark_magenta(self) -> StyledBuf

Source

pub fn on_dark_magenta(self) -> StyledBuf

Source

pub fn underline_dark_magenta(self) -> StyledBuf

Source

pub fn cyan(self) -> StyledBuf

Source

pub fn on_cyan(self) -> StyledBuf

Source

pub fn underline_cyan(self) -> StyledBuf

Source

pub fn dark_cyan(self) -> StyledBuf

Source

pub fn on_dark_cyan(self) -> StyledBuf

Source

pub fn underline_dark_cyan(self) -> StyledBuf

Source

pub fn white(self) -> StyledBuf

Source

pub fn on_white(self) -> StyledBuf

Source

pub fn underline_white(self) -> StyledBuf

Source

pub fn grey(self) -> StyledBuf

Source

pub fn on_grey(self) -> StyledBuf

Source

pub fn underline_grey(self) -> StyledBuf

Trait Implementations§

Source§

impl Clone for StyledBuf

Source§

fn clone(&self) -> StyledBuf

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StyledBuf

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for StyledBuf

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&str> for StyledBuf

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Option<&str>> for StyledBuf

Source§

fn from(value: Option<&str>) -> Self

Converts to this type from the input type.
Source§

impl From<Option<String>> for StyledBuf

Source§

fn from(value: Option<String>) -> Self

Converts to this type from the input type.
Source§

impl<T: Display> From<Option<StyledContent<T>>> for StyledBuf

Source§

fn from(value: Option<StyledContent<T>>) -> Self

Converts to this type from the input type.
Source§

impl<E> From<Result<&str, E>> for StyledBuf

Source§

fn from(value: Result<&str, E>) -> Self

Converts to this type from the input type.
Source§

impl<E> From<Result<String, E>> for StyledBuf

Source§

fn from(value: Result<String, E>) -> Self

Converts to this type from the input type.
Source§

impl<T: Display, E> From<Result<StyledContent<T>, E>> for StyledBuf

Source§

fn from(value: Result<StyledContent<T>, E>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for StyledBuf

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl<T: Display> From<StyledContent<T>> for StyledBuf

Source§

fn from(value: StyledContent<T>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<StyledBuf> for StyledBuf

Source§

fn from_iter<T: IntoIterator<Item = StyledBuf>>(iter: T) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.