Crate ezemoji

Source
Expand description

§ezemoji

ezemoji is a lightweight Rust library for working with Unicode character groups, including letters, numbers, symbols, and emojis. It is always no_std and stores all data as &'static [u32], making it suitable for embedded and minimal runtime environments.

§Usage

You can use the predefined character groups, or define your own custom groups.

§Using predefined groups

#[cfg(feature = "std")]
use ezemoji::{CharGroup, GroupKind};

// Iterate over lowercase alphabet characters
let alpha_group = CharGroup::ALPHALOW;
for cp in alpha_group.iter() {
    // Print the Unicode code point
    println!("{}", cp);
}

// Access a numeric group and check display width
let num_group = CharGroup::NUM;
assert_eq!(num_group.width(), 1); // ASCII numbers are single-width

§Defining your own custom group

use ezemoji::{CharGroup, GroupKind, CharWidth, MultiRange};

// Create a new custom group of just crab emojis
let crab_group = CharGroup::new(GroupKind::Custom("crab"), MultiRange::new(&[0x1F980..0x1F981]), CharWidth::Double);
assert_eq!(crab_group.width(), 2); // This emoji is double-width

Structs§

CharGroup
A named group of Unicode characters.
MultiRange
MultiRangeIterator

Enums§

CharWidth
GroupKind

Constants§

ALPHALOW_RANGE
ALPHANUM_RANGE
ALPHAUP_RANGE
ARROW_0_RANGE
ARROW_1_RANGE
ARROW_2_RANGE
BIN_RANGE
BRAILLE_RANGE
CARD_0_RANGE
CARD_1_RANGE
CARD_2_RANGE
CARD_3_RANGE
CLOCK_RANGE
CRAB_RANGE
DOMINOSH_RANGE
DOMINOSV_RANGE
EARTH_RANGE
EMOJIS_0_RANGE
EMOJIS_1_RANGE
EMOJIS_2_RANGE
JAP_RANGE
LARGELETTERS_RANGE
LETTEREDCUBES_RANGE
MOON_RANGE
NUMBEREDBALLS_RANGE
NUM_RANGE
PLANTS_RANGE
SHAPES_RANGE
SMILE_RANGE