Struct terminal_emoji::Emoji[][src]

pub struct Emoji<'a>(pub &'a str, pub &'a str);

An emoji with safety fallback.

The struct wraps an emoji and only renders it on platforms that actually support it. On non-supported platforms the fallback value is being rendered.

Support is determined by two factors:

  1. The processes stdout has to be a tty.
  2. Platform dependent:
    • macOS has emoji support by default
    • Unix systems have support if the active language supports them.
    • Windows machines running the new Terminal app support emojis.

Implementations

impl<'a> Emoji<'a>[src]

pub const fn new(emoji: &'a str, fallback: &'a str) -> Self[src]

Create a new emoji.

Arguments

  • emoji: The unicode emoji to display.
  • fallback: The fallback value to use on non-supported platforms.

Trait Implementations

impl<'a> Clone for Emoji<'a>[src]

impl<'a> Copy for Emoji<'a>[src]

impl<'a> Debug for Emoji<'a>[src]

impl Display for Emoji<'_>[src]

impl<'a> Eq for Emoji<'a>[src]

impl<'a> From<(&'a str, &'a str)> for Emoji<'a>[src]

impl<'a> Hash for Emoji<'a>[src]

impl<'a> PartialEq<Emoji<'a>> for Emoji<'a>[src]

impl<'a> StructuralEq for Emoji<'a>[src]

impl<'a> StructuralPartialEq for Emoji<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Emoji<'a>

impl<'a> Send for Emoji<'a>

impl<'a> Sync for Emoji<'a>

impl<'a> Unpin for Emoji<'a>

impl<'a> UnwindSafe for Emoji<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.