magc/helpers.rs
1use unicode_segmentation::UnicodeSegmentation;
2
3/// Split up a Unicode source string into a collection of graphemes.
4///
5/// The grapheme is closest to what would be considered a text character in the human
6/// sense, enabling us handle Unicode variable names and strings with relative ease.
7pub fn convert_to_graphemes(input: String) -> Vec<String> {
8 input.graphemes(true).map(|g| g.to_string()).collect()
9}