Skip to main content

Prompt

Trait Prompt 

Source
pub trait Prompt {
    // Required method
    fn raw(&self) -> &str;

    // Provided method
    fn styled(&self) -> &str { ... }
}
Expand description

Provide two versions of the prompt:

  • the raw version used when stdout is not a tty, or when the terminal is not supported or in NO_COLOR mode
  • the styled version

Required Methods§

Source

fn raw(&self) -> &str

No style, no ANSI escape sequence

Provided Methods§

Source

fn styled(&self) -> &str

With style(s), ANSI escape sequences

Currently, the styled version must have the same display width as the raw version.

By default, returns the raw string.

Implementations on Foreign Types§

Source§

impl Prompt for str

Source§

fn raw(&self) -> &str

Source§

impl Prompt for String

Source§

fn raw(&self) -> &str

Source§

impl<Raw: AsRef<str>, Styled: AsRef<str>> Prompt for (Raw, Styled)

Source§

fn raw(&self) -> &str

Source§

fn styled(&self) -> &str

Implementors§