Struct emojis::Emoji[][src]

pub struct Emoji { /* fields omitted */ }
Expand description

Represents an emoji.

See Unicode.org for more information.

Implementations

Returns this emoji as a string.

Examples
let rocket = emojis::lookup("🚀").unwrap();
assert_eq!(rocket.as_str(), "🚀")

Returns the CLDR short name for this emoji.

Examples
let cool = emojis::lookup("😎").unwrap();
assert_eq!(cool.name(), "smiling face with sunglasses");

Returns this emoji’s group.

Examples
let flag = emojis::lookup("🇿🇦").unwrap();
assert_eq!(flag.group(), Group::Flags);

Returns the skin tone of this emoji.

Examples
use emojis::SkinTone;

let peace = emojis::lookup("✌️").unwrap();
assert_eq!(peace.skin_tone(), Some(SkinTone::Default));

let peace = emojis::lookup("✌🏽").unwrap();
assert_eq!(peace.skin_tone(), Some(SkinTone::Medium));

For emojis where skin tones are not applicable this will be None.

let cool = emojis::lookup("😎").unwrap();
assert!(cool.skin_tone().is_none());

Returns an iterator over the emoji and all the related skin tone emojis.

Examples
use emojis::Emoji;

let luck = emojis::lookup("🤞🏼").unwrap();
let tones: Vec<_> = luck.skin_tones().unwrap().map(Emoji::as_str).collect();
assert_eq!(tones, ["🤞", "🤞🏻", "🤞🏼", "🤞🏽", "🤞🏾", "🤞🏿"]);

For emojis where skin tones are not applicable this will return None.

let cool = emojis::lookup("😎").unwrap();
assert!(cool.skin_tones().is_none());

Returns a version of this emoji that has the given skin tone.

Examples
use emojis::SkinTone;

let peace = emojis::lookup("🙌🏼")
    .unwrap()
    .with_skin_tone(SkinTone::MediumDark)
    .unwrap();
assert_eq!(peace, emojis::lookup("🙌🏾").unwrap());

For emojis where skin tones are not applicable this will be None.

use emojis::SkinTone;

let cool = emojis::lookup("😎").unwrap();
assert!(cool.with_skin_tone(SkinTone::Medium).is_none());

Returns this emoji’s GitHub shortcode.

See gemoji for more information.

Examples
let thinking = emojis::lookup("🤔").unwrap();
assert_eq!(thinking.shortcode().unwrap(), "thinking");

Trait Implementations

Performs the conversion.

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

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

This method tests for !=.

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