emojic đ đ đ
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
[]
= "0.5"
đ§ Example
use Gender;
use Pair;
use Tone;
use *;
println!;
println!;
println!;
println!;
println!;
println!;
đ¨ď¸ Output
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 & dark: đđżââď¸
This crate contains emojis constants based on the Full Emoji List v13.1. Including its categorization:
assert_eq!;
As well as iterators to list all the emojis in each group and subgroup:
// Iterates all hand emoji: đ, đ, đ¤, đ, đ¤˛, đ
base_emojis
Additional, it has functions to generate (arbitrary) country and regional flags.
// đ´ó §ó ˘ó Ľó Žó §ó ż ⊠đ´ó §ó ˘ó łó Łó ´ó ż â đŹđ§ â đŞđş
println!
Finally, this crate has allows parsing emoji aliases from the github/gemoji
list via parse_alias.
parse_alias // đ
parse_alias // đŻ
parse_alias // đŠâđ
And it has also an utility to parse and replace these emoji aliases in text via
parse_text.
// a 𼪠consists of đ, đĽ, and some đ§
parse_text
đ 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.
-
default: (impliesalloc)
Automatically enabled if not opt-out:[] = "0.4" = false -
alloc: (implieshashbrownandlazy_static)
Requires a global allocator, enables some additional functions: theparse_textfunction and the ad-hoc flag-functions (country_flag®ional_flag) (the flag constants are unaffected).Notice, that
lazy_static, by default, pulls-instdto use mutices for waiting. This is good if you do havestdavailable, and bad if not. However, the alternative is to instructlazy_staticto use spinlocks instead. Yet, since crate-features are unified by Cargo, it would be bad for all user that havestd, to requiring it by default. Instead, if you want to use thisallocfeature, but you don't havestd(e.g. in your binary crate), you can simply addlazy_staticyourself, and make it to use spinlocks, which will apply globally. E.g. add to yourCargo.toml:[] = "1.4" = ["spin_no_std"]Also see: https://github.com/rust-lang-nursery/lazy-static.rs/issues/150
đ 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.