number-based 0.2.3

number-based is an attempt of mine to make working with number bases simple.
Documentation
use once_cell::sync::Lazy;
use std::collections::HashMap;

use super::custom_graphemes::create_non_standard;

pub static GRAPHEMES: Lazy<HashMap<u16, [u8; 4]>> = Lazy::new(create_graphemes);

// utf-8 magic
// The HashMap intentionally has [u8; 4] values because they will need to be converted back
// into utf-8 later in Self::display()
fn create_graphemes() -> HashMap<u16, [u8; 4]> {
    if cfg!(feature = "custom_graphemes") {
        match create_non_standard() {
            Ok(g) => g,
            Err(e) => {
                println!("{e}");
                println!("Could not create custom graphemes. Creating standard graphemes");
                create_standard_graphemes()
            }
        }
    } else {
        create_standard_graphemes()
    }
}

fn create_standard_graphemes() -> HashMap<u16, [u8; 4]> {
    let mut ind_base10 = 0;
    let mut graphemes = HashMap::new();

    // numbers 0-9
    for i in 48..=57 {
        graphemes.insert(ind_base10, [0, 0, 0, i]);
        ind_base10 += 1;
    }

    // alphabet A-Z
    for i in 65..=90 {
        graphemes.insert(ind_base10, [0, 0, 0, i]);
        ind_base10 += 1;
    }

    for i in 194..=223 {
        for j in 128..=191 {
            graphemes.insert(ind_base10, [0, 0, i, j]);
            ind_base10 += 1;
        }
    }
    for i in 160..=191 {
        for j in 128..=191 {
            graphemes.insert(ind_base10, [0, 224, i, j]);
            ind_base10 += 1;
        }
    }
    'out: for i in 225..=238 {
        for j in 128..=191 {
            for k in 128..=191 {
                if (i, j, k) == (237, 160, 128) {
                    break 'out;
                }
                graphemes.insert(ind_base10, [0, i, j, k]);
                ind_base10 += 1;
            }
        }
    }

    graphemes
}