emojic 😀 🙂 😇

Crates.io Documentation License

Emoji constants for your rusty strings. This crate is inspired by the Go library emoji written by @enescakir.

Notice that this file uses the actual Unicode emojis to given visual example of the result. However, depending on the font and support on your device, not all emojis might be represented correctly, especially the newer ones.

📦 Cargo.toml

toml [dependencies] emojic = "0.3"

🔧 Example

```rust use emojic::Gender; use emojic::Pair; use emojic::Tone; use emojic::flat::*;

println!("Hello {}", WAVINGHAND); println!( "I'm {} from {}", TECHNOLOGIST.gender(Gender::Male), FLAGTURKEY ); println!( "Different skin tones default {} light {} dark {}", THUMBSUP, OKHAND.tone(Tone::Light), CALLMEHAND.tone(Tone::Dark) ); println!( "Multiple skin tones: default: {}, same: {} different: {}", PERSONHOLDINGHANDS, PERSONHOLDINGHANDS.tone(Tone::Medium), PERSONHOLDINGHANDS.tone((Tone::Light, Tone::Dark)) ); println!( "Different sexes: default: {} male: {}, female: {}", GENIE, GENIE.gender(Gender::Male), GENIE.gender(Gender::Female), ); println!( "Mixing attributes: men & light: {} and women & drak: {}", PERSONTIPPINGHAND.gender(Gender::Male).tone(Tone::Light), PERSONTIPPINGHAND.gender(Gender::Female).tone(Tone::Dark), ); ```

🖨️ Output

text Hello 👋 I'm 👨‍💻 from 🇹🇷 Different skin tones default 👍 light 👌🏻 dark 🤙🏿 Multiple skin tones: default: 🧑‍🤝‍🧑, same: 🧑🏽‍🤝‍🧑🏽 different: 🧑🏻‍🤝‍🧑🏿 Different sexes: default: 🧞 male: 🧞‍♂️, female: 🧞‍♀️ Mixing attributes: men & light: 💁🏻‍♂️ and women & drak: 💁🏿‍♀️

This crate contains emojis constants based on the Full Emoji List v13.1. Including its categorization:

rust assert_eq!( emojic::grouped::people_and_body::hands::OPEN_HANDS, //🤲 emojic::flat::OPEN_HANDS, //🤲 );

As well as iterators to list all the emojis in each group and subgroup:

rust // Iterates all hand emoji: 👏, 🙏, 🤝, 👐, 🤲, 🙌 emojic::grouped::people_and_body::hands::base_emojis()

Additional, it has functions to generate (arbitrary) country and regional flags.

rust // 🏴󠁧󠁢󠁥󠁮󠁧󠁿 ∩ 🏴󠁧󠁢󠁳󠁣󠁴󠁿 ⊂ 🇬🇧 ⊄ 🇪🇺 println!("{} ∩ {} ⊂ {} ⊄ {}", regional_flag("GB-ENG"), regional_flag("GB-SCT"), country_flag("GB"), country_flag("EU"), )

Finally, this crate has allows parsing emoji aliases from the github/gemoji list via parse_alias.

rust parse_alias(":+1:") // 👍 parse_alias(":100:") // 💯 parse_alias(":woman_astronaut:") // 👩‍🚀

And it has also an utility to parse and replace these emoji aliases in text via parse_text.

rust // a 🥪 consists of 🍞, 🥓, and some 🧀 parse_text("a :sandwich: consists of :bread:, :bacon:, and some :cheese:")

🔭 Examples

For more examples have a look at the examples folder.

🧩 Crate features

This crate is no_std by default, means it should be usable in WASM and other restricted platforms. However, some additional functions need the alloc crate (normally part of std), thus it is enabled by default.

📝 License

Licensed under MIT License (LICENSE).

🚧 Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.