use hashbrown::HashMap; lazy_static::lazy_static! { pub static ref ALIAS_TABLE: spin::Mutex = spin::Mutex::new(AliasTable::new()); } /// A table of aliases /// /// This is used to allow users to specify aliases for files and commands pub struct AliasTable { pub table: HashMap, } impl AliasTable { pub fn new() -> Self { Self { table: HashMap::new(), } } pub fn add_alias(&mut self, alias: String, path: String) { self.table.insert(alias, path); } pub fn get_alias(&self, alias: String) -> Option { let alias_table = ALIAS_TABLE.lock(); alias_table.table.get(&alias).map(|x| x.to_string()) } }