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

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

impl PartialEq for Chalk

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

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

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

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