use crate::{
debug,
fallback::{Chain, FallbackChain}, map_loader::MapLoader, trace,
LangID,
};
use std::{
hash::BuildHasher,
ops::{Deref, DerefMut},
};
impl<S: BuildHasher> DerefMut for MapLoader<S> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.id }
}
impl<S: BuildHasher> Deref for MapLoader<S> {
type Target = LangID;
fn deref(&self) -> &Self::Target {
&self.id }
}
impl<S: BuildHasher> FallbackChain for MapLoader<S> {
fn get_id(&self) -> &LangID {
&self.id }
fn set_chain_once(&self, custom: Option<Chain>) -> &Chain {
self.chain
.get_or_init(|| self.new_chain(custom))
}
fn get_locale_list(&self) -> Chain {
trace!("About to get the locale list");
debug!("{}", self.get_id());
self.map
.keys()
.filter(|&x| self.locale_list_filter(x))
.cloned()
.collect()
}
}