mod de; mod fr; mod us; use std::{collections::HashMap, fmt::Display, hash::Hash}; use crate::{ countries::{de::GermanHolidays, fr::FrenchHolidays, us::USHolidays}, holiday::{Activity, Holiday}, }; trait CountryHolidays where T: StateList, { /// Returns a Tuple consisting of the identifier for all states and the holiday days fn new() -> (String, Vec); } #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum CountryCode { DE, US, FR, } impl CountryCode { pub(crate) fn get_holidays(&self) -> (String, Vec) { match self { CountryCode::DE => GermanHolidays::new(), CountryCode::US => USHolidays::new(), CountryCode::FR => FrenchHolidays::new(), } } } pub(crate) trait StateList where Self: Sized + Display + Hash + Eq, { fn list(states: &[(Self, &[Activity])]) -> HashMap> { let mut map = HashMap::new(); for state in states { map.insert(state.0.to_string(), state.1.to_vec()); } map } fn all_states_identifier() -> String; }