Struct interpreter::Chalk

source ·
pub struct Chalk { /* private fields */ }

Implementations§

source§

impl Chalk

For all Chalks with different color types

source

pub fn new() -> Chalk

Creates a Chalk with a black background and a white foreground

§Example
use chalk_rs::Chalk;

let mut chalk = Chalk::new();
// the chalk can be used here
source

pub fn string(&self, string: &dyn ToString) -> String

Formats a string using the style of the given Chalk.

This will return the string after being formatted to the console. When using string literals, please use a reference.

For example:

chalk.yellow().string(&"this is yellow");
§Arguments
  • string - The item to print out. It must implement ToString and should be a reference
§Example
use chalk_rs::Chalk;

let mut chalk = Chalk::new();
let text = chalk.yellow().string(&"this is yellow");
source

pub fn print(&self, string: &dyn ToString) -> String

Prints a string using the style of the given chalk.

This will return the text that was outputted to the console. When using string literals, please use a reference.

For example:

chalk.yellow().print(&"this is yellow");
§Arguments
  • string - The item to format and output. It must implement ToString and should be a reference.
§Example
use chalk_rs::Chalk;

let mut chalk = Chalk::new();
chalk.yellow().print(&"this is yellow");
source

pub fn println(&self, string: &dyn ToString) -> String

Prints a string using the style of the given chalk on a new line.

This will return the text that was outputted to the console. When using string literals, please use a reference.

For example:

chalk.yellow().println(&"this is yellow");
§Arguments
  • string - The item to format and output. It must implement ToString and should be a reference.
§Example
use chalk_rs::Chalk;

let mut chalk = Chalk::new();
chalk.yellow().println(&"this is yellow");
source§

impl Chalk

source

pub fn default_color(&mut self) -> &mut Chalk

source

pub fn black(&mut self) -> &mut Chalk

source

pub fn red(&mut self) -> &mut Chalk

source

pub fn green(&mut self) -> &mut Chalk

source

pub fn yellow(&mut self) -> &mut Chalk

source

pub fn blue(&mut self) -> &mut Chalk

source

pub fn magenta(&mut self) -> &mut Chalk

source

pub fn cyan(&mut self) -> &mut Chalk

source

pub fn light_gray(&mut self) -> &mut Chalk

source

pub fn light_grey(&mut self) -> &mut Chalk

source

pub fn gray(&mut self) -> &mut Chalk

source

pub fn grey(&mut self) -> &mut Chalk

source

pub fn light_black(&mut self) -> &mut Chalk

source

pub fn light_red(&mut self) -> &mut Chalk

source

pub fn light_green(&mut self) -> &mut Chalk

source

pub fn light_yellow(&mut self) -> &mut Chalk

source

pub fn light_blue(&mut self) -> &mut Chalk

source

pub fn light_magenta(&mut self) -> &mut Chalk

source

pub fn light_cyan(&mut self) -> &mut Chalk

source

pub fn white(&mut self) -> &mut Chalk

source

pub fn ansi(&mut self, color: u8) -> &mut Chalk

source

pub fn rgb(&mut self, r: u8, g: u8, b: u8) -> &mut Chalk

source§

impl Chalk

source

pub fn default_background(&mut self) -> &mut Chalk

source

pub fn bg_black(&mut self) -> &mut Chalk

source

pub fn bg_red(&mut self) -> &mut Chalk

source

pub fn bg_green(&mut self) -> &mut Chalk

source

pub fn bg_yellow(&mut self) -> &mut Chalk

source

pub fn bg_blue(&mut self) -> &mut Chalk

source

pub fn bg_magenta(&mut self) -> &mut Chalk

source

pub fn bg_cyan(&mut self) -> &mut Chalk

source

pub fn bg_light_gray(&mut self) -> &mut Chalk

source

pub fn bg_light_grey(&mut self) -> &mut Chalk

source

pub fn bg_gray(&mut self) -> &mut Chalk

source

pub fn bg_grey(&mut self) -> &mut Chalk

source

pub fn bg_light_black(&mut self) -> &mut Chalk

source

pub fn bg_light_red(&mut self) -> &mut Chalk

source

pub fn bg_light_green(&mut self) -> &mut Chalk

source

pub fn bg_light_yellow(&mut self) -> &mut Chalk

source

pub fn bg_light_blue(&mut self) -> &mut Chalk

source

pub fn bg_light_magenta(&mut self) -> &mut Chalk

source

pub fn bg_light_cyan(&mut self) -> &mut Chalk

source

pub fn bg_white(&mut self) -> &mut Chalk

source

pub fn bg_ansi(&mut self, color: u8) -> &mut Chalk

source

pub fn bg_rgb(&mut self, r: u8, g: u8, b: u8) -> &mut Chalk

source§

impl Chalk

source

pub fn reset_style(&mut self) -> &mut Chalk

source

pub fn reset_weight(&mut self) -> &mut Chalk

source

pub fn bold(&mut self) -> &mut Chalk

source

pub fn dim(&mut self) -> &mut Chalk

source

pub fn italic(&mut self) -> &mut Chalk

source

pub fn unitalic(&mut self) -> &mut Chalk

source

pub fn no_underline(&mut self) -> &mut Chalk

source

pub fn underline(&mut self) -> &mut Chalk

source

pub fn double_underline(&mut self) -> &mut Chalk

source

pub fn invert(&mut self) -> &mut Chalk

source

pub fn uninvert(&mut self) -> &mut Chalk

source

pub fn hide(&mut self) -> &mut Chalk

source

pub fn unhide(&mut self) -> &mut Chalk

source

pub fn is_normal_weight(&self) -> bool

source

pub fn is_bold(&self) -> bool

source

pub fn is_dim(&self) -> bool

source

pub fn is_italicized(&self) -> bool

source

pub fn has_underlines(&self) -> bool

source

pub fn is_single_underlined(&self) -> bool

source

pub fn is_double_underlined(&self) -> bool

source

pub fn is_blinking(&self) -> bool

source

pub fn is_inverted(&self) -> bool

source

pub fn is_hidden(&self) -> bool

source

pub fn num_underlines(&self) -> u8

Trait Implementations§

source§

impl Clone for Chalk

source§

fn clone(&self) -> Chalk

Returns a copy 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 Chalk

source§

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

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

impl Default for Chalk

source§

fn default() -> Chalk

Returns the “default value” for a type. Read more
source§

impl Display for Chalk

source§

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

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

impl Hash for Chalk

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Chalk

source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Chalk

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Chalk

source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for Chalk

source§

impl StructuralPartialEq for Chalk

Auto Trait Implementations§

§

impl Freeze for Chalk

§

impl RefUnwindSafe for Chalk

§

impl Send for Chalk

§

impl Sync for Chalk

§

impl Unpin for Chalk

§

impl UnwindSafe for Chalk

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> 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,

§

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§

default 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>,

§

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>,

§

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.