use super::insert_unique;
use std::collections::HashMap;
use std::sync::OnceLock;
pub type SymbolRule = (&'static str, &'static str);
const SYMBOL_RULES: &[SymbolRule] = &[
(".", "।"), ("$", "৳"), ];
fn build_symbols() -> HashMap<&'static str, &'static str> {
let mut map = HashMap::with_capacity(SYMBOL_RULES.len());
for &(roman, bengali) in SYMBOL_RULES {
insert_unique(&mut map, "symbol", roman, bengali);
}
map
}
pub const fn symbol_rules() -> &'static [SymbolRule] {
SYMBOL_RULES
}
pub fn symbol_value(roman: &str) -> Option<&'static str> {
match roman {
"." => Some("।"),
"$" => Some("৳"),
_ => None,
}
}
pub fn symbols_static() -> &'static HashMap<&'static str, &'static str> {
static INSTANCE: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();
INSTANCE.get_or_init(build_symbols)
}
pub fn symbols() -> HashMap<&'static str, &'static str> {
symbols_static().clone()
}