html_generator::emojis

Function load_emoji_sequences

Source
pub fn load_emoji_sequences<P: AsRef<Path>>(
    filepath: P,
) -> Result<HashMap<String, String>, Error>
Expand description

Loads emoji sequences and their descriptive labels from a file.

This function processes files formatted with semicolon-separated fields. For example, a line in the file might look like:

2B06 FE0F ; Basic_Emoji ; up

The mapping constructed will use the UTF-8 emoji sequence as the key and a normalized, human-readable label as the value. For instance:

  • "⚡""high-voltage-sign"

Lines starting with # or empty lines are ignored. Comments after a # are parsed to extract descriptive labels.

§Arguments

  • filepath - A path-like reference to the input file, such as "emoji-data.txt".

§Returns

A HashMap<String, String> where:

  • Keys are emoji strings (e.g., "⚡").
  • Values are normalized, lowercase, dash-separated labels (e.g., "high-voltage-sign").

§Errors

Returns a Result indicating success or failure to read the file.