Enum paris::formatter::LogIcon

source ·
pub enum LogIcon {
    Tick,
    Cross,
    Info,
    Warning,
    Heart,
    None,
}
Expand description

Contains definitions for icons that can be used in the terminal. See this github repo for an entire list. Use this in combination with printing macros.

Variants§

§

Tick

A check mark, use when things go well

Example

use paris::LogIcon;

println!("{} Everything went well", LogIcon::Tick);
// ✔ Everything went well
§

Cross

A cross, use when things go bad, or be creative

Example

println!("{} Oops, try again!", LogIcon::Cross);
// ✖ Oops, try again!
§

Info

A fancy ‘i’, for information

Example

println!("{} In Switzerland it is illegal to own just one guinea pig", LogIcon::Info);
// ℹ In Switzerland it is illegal to own just one guinea pig.
§

Warning

A triangle with an exclamation mark in it, dangerous

Example

println!("{} Things are starting to catch fire!", LogIcon::Warning);
// ⚠ Things are starting to catch fire!
§

Heart

❤️🦄

Example

// You get it...
§

None

No icon. Empty string. Nada. This is here to return something for the parser when it doesn’t match any given keys

Implementations§

source§

impl LogIcon

source

pub fn to_str<'a>(&self) -> &'a str

Match the enum value and return the equivalent icon. See this github repo for all icons

Trait Implementations§

source§

impl Display for LogIcon

source§

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

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

impl<'a> From<&'a str> for LogIcon

source§

fn from(s: &'a str) -> Self

Converts to this type from the input type.
source§

impl FromStr for LogIcon

§

type Err = ()

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToString for Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.