Struct StyledStr

struct StyledStr(_)

Terminal-styling container

Styling may be encoded as ANSI Escape Code

Examples

# use clap_builder as clap;
// `cstr!` converts tags to ANSI codes
let after_help: &'static str = color_print::cstr!(
r#"<bold><underline>Examples</underline></bold>

  <dim>$</dim> <bold>mybin --input file.toml</bold>
"#);

let cmd = clap::Command::new("mybin")
    .after_help(after_help)  // The `&str` gets converted into a `StyledStr`
    // ...
#   ;

Implementations

impl StyledStr

const fn new() -> Self

Create an empty buffer

fn ansi(self: &Self) -> impl Display + '_

Display using ANSI Escape Code styling

impl Clone for StyledStr

fn clone(self: &Self) -> StyledStr

impl Debug for StyledStr

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

impl Default for StyledStr

fn default() -> StyledStr

impl Display for StyledStr

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

impl Eq for StyledStr

impl Freeze for StyledStr

impl From for StyledStr

fn from(name: &'static str) -> Self

impl From for StyledStr

fn from(name: String) -> Self

impl From for StyledStr

fn from(name: &&'static str) -> Self

impl From for StyledStr

fn from(name: &String) -> Self

impl Ord for StyledStr

fn cmp(self: &Self, other: &StyledStr) -> Ordering

impl PartialEq for StyledStr

fn eq(self: &Self, other: &StyledStr) -> bool

impl PartialOrd for StyledStr

fn partial_cmp(self: &Self, other: &StyledStr) -> Option<Ordering>

impl RefUnwindSafe for StyledStr

impl Send for StyledStr

impl StructuralPartialEq for StyledStr

impl Sync for StyledStr

impl Unpin for StyledStr

impl UnsafeUnpin for StyledStr

impl UnwindSafe for StyledStr

impl Write for StyledStr

fn write_str(self: &mut Self, s: &str) -> Result<(), Error>
fn write_char(self: &mut Self, c: char) -> Result<(), Error>

impl<I> IntoResettable for StyledStr

fn into_resettable(self: Self) -> Resettable<StyledStr>

impl<T> Any for StyledStr

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for StyledStr

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for StyledStr

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

impl<T> CloneToUninit for StyledStr

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

impl<T> From for StyledStr

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for StyledStr

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for StyledStr

fn to_string(self: &Self) -> String

impl<T, U> Into for StyledStr

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for StyledStr

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

impl<T, U> TryInto for StyledStr

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