Skip to main content

load_emoji_sequences

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 is a convenience wrapper around parse_emoji_sequences for loading from a filesystem path.

§Arguments

  • filepath - A path-like reference to the input file.

§Returns

A HashMap<String, String> mapping emoji strings to labels.

§Errors

Returns an error if the file cannot be read.

§Examples

use html_generator::emojis::load_emoji_sequences;
use std::io::Write;

let mut file = tempfile::NamedTempFile::new().unwrap();
writeln!(file, "26A1 ; emoji ; L1 ; none ; a j # V4.0 (⚡) HIGH VOLTAGE SIGN").unwrap();
let map = load_emoji_sequences(file.path()).unwrap();
assert_eq!(map.get("⚡"), Some(&"high-voltage-sign".to_string()));