Struct text_utils::Emoji[][src]

pub struct Emoji {
    pub name: &'static str,
    pub since: Version,
    pub grapheme: &'static str,
}
Expand description

A specific emoji.

This is the basic type for all emojis, whether obtained via any of the statics (as defined in the grouped and flat module) or functions such as parse_alias.

Tho, some statics are declared as With or WithNoDef. These represent customizable emojis (i.e. a set of similar emojis), and provide functions for customizations (such as With::tone, With::gender, and With::hair), which take an attribute to be customized (such as Tone, Gender, or Hair respectively) and will eventually yield an Emoji.

Emoji implements Display to be directly printable (e.g. with println!). This will simply print the grapheme (the Unicode sequence) of this emoji. Additionally, this struct contains some meta data such as the explanatory name of the emoji.

let art = Emoji {
    name: "artist palette",
    since: Version(0,6), // E0.6
    grapheme: "🎨",
};
assert_eq!(emojic::flat::ARTIST_PALETTE, art);

Fields

name: &'static str

The full name of this emoji, much like a short description.

since: Version

The Unicode Emoji version when this grapheme (i.e. emoji) was first introduced.

Notice, that since this stated version the recommended visuals may have changed or additional variants might have been added related to this emoji. In that case, the individual variants (which have their own Emoji instance) may have a different version than the ‘default’ variant, depending on when they were first added, respetively.

grapheme: &'static str

The Unicode codepoint sequence of this emoji. The actual/rendered emoji.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.