Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelodder7 committed Nov 7, 2024
1 parent c8f1e31 commit dbc139a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl Country {

country!(cyprus, "196", 196, "CY", "CYP", "Cyprus");

country!(czechia, "203", 203, "CZ", "CZE", "Czechia");
country!(czechia, "203", 203, "CZ", "CZE", "Czechia", CzechiaTable, "CzechRepublic");

country!(denmark, "208", 208, "DK", "DNK", "Denmark");

Expand Down Expand Up @@ -1047,7 +1047,7 @@ impl Country {
"GM",
"GMB",
"The Gambia",
GabmiaTable,
GambiaTable,
"Gabmia"
);

Expand Down Expand Up @@ -1239,7 +1239,7 @@ impl Country {
"UnitedStatesOfAmerica"
);

country!(timor_leste, "626", 626, "TL", "TLS", "Timor Leste");
country!(timor_leste, "626", 626, "TL", "TLS", "Timor Leste", TimorTable, "EastTimor");

country!(togo, "768", 768, "TG", "TGO", "Togo");

Expand Down Expand Up @@ -2827,6 +2827,7 @@ impl Country {
map.insert("comoros", Country::the_comoros());
map.insert("congo", Country::the_congo());
map.insert("cookislands", Country::the_cook_islands());
map.insert("czechrepublic", Country::czechia());
for s in ["northkorea", "democraticpeoplesrepublicofkorea"] {
map.insert(s, Country::the_democratic_peoples_republic_of_korea());
}
Expand All @@ -2835,6 +2836,7 @@ impl Country {
Country::the_democratic_republic_of_the_congo(),
);
map.insert("dominicanrepublic", Country::the_dominican_republic());
map.insert("easttimor", Country::timor_leste());
for s in ["malvinas", "falklandislands"] {
map.insert(s, Country::the_falkland_islands_malvinas());
}
Expand All @@ -2843,7 +2845,7 @@ impl Country {
"frenchsouthernterritories",
Country::the_french_southern_territories(),
);
map.insert("gabmia", Country::the_gambia());
map.insert("gambia", Country::the_gambia());
map.insert("holysee", Country::the_holy_see());
map.insert(
"laopeoplesdemocraticrepublic",
Expand Down Expand Up @@ -3231,6 +3233,7 @@ impl Country {
Country::the_united_states_of_america(),
);
map.insert("timorleste", Country::timor_leste());
map.insert("easttimor", Country::timor_leste());
map.insert("togo", Country::togo());
map.insert("tokelau", Country::tokelau());
map.insert("tonga", Country::tonga());
Expand Down Expand Up @@ -3481,7 +3484,7 @@ impl FromStr for Country {
for s in ["cyprus", "196", "cy", "cyp"] {
map.insert(s, Country::cyprus());
}
for s in ["czechia", "203", "cz", "cze"] {
for s in ["czechia", "czechrepublic", "203", "cz", "cze"] {
map.insert(s, Country::czechia());
}
for s in ["denmark", "208", "dk", "dnk"] {
Expand Down Expand Up @@ -4134,7 +4137,7 @@ impl FromStr for Country {
] {
map.insert(s, Country::the_french_southern_territories());
}
for s in ["thegambia", "the_gambia", "270", "gm", "gmb", "gabmia"] {
for s in ["thegambia", "the_gambia", "270", "gm", "gmb", "gambia"] {
map.insert(s, Country::the_gambia());
}
for s in ["theholysee", "the_holy_see", "336", "va", "vat", "holysee"] {
Expand Down
26 changes: 20 additions & 6 deletions src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ lookup!(DominicanRepublicTable, DominicanRepublic, "The Dominican Republic", 1,
lookup!(MalvinasTable, Malvinas, "The Falkland Islands Malvinas", 2, "Malvinas" => "malvinas", "FalklandIslands" => "falklandislands");
lookup!(FaroeIslandsTable, FaroeIslands, "The Faroe Islands", 1, "FaroeIslands" => "faroeislands");
lookup!(FrenchSouthernTerritoriesTable, FrenchSouthernTerritories, "The French Southern Territories", 1, "FrenchSouthernTerritories" => "frenchsouthernterritories");
lookup!(GabmiaTable, Gabmia, "The Gabmia", 1, "Gabmia" => "gabmia");
lookup!(GambiaTable, Gambia, "The Gambia", 1, "Gambia" => "gambia");
lookup!(HolySeeTable, HolySee, "The Holy See", 1, "HolySee" => "holysee");
lookup!(LaoPeoplesDemocraticRepublicTable, LaoPeoplesDemocraticRepublic, "The Lao Peoples Democratic Republic", 1, "LaoPeoplesDemocraticRepublic" => "laopeoplesdemocraticrepublic");
lookup!(MarshallIslandsTable, MarshallIslands, "The Marshall Islands", 1, "MarshallIslands" => "marshallislands");
Expand All @@ -258,6 +258,8 @@ lookup!(AmericaTable, America, "The United States Of America", 3, "America" => "
lookup!(TrinidadTable, Trinidad, "Trinidad And Tobago", 2, "Trinidad" => "trinidad", "Tobago" => "tobago");
lookup!(TanzaniaTable, Tanzania, "United Republic Of Tanzania", 1, "Tanzania" => "tanzania");
lookup!(TurkeyTable, Turkey, "Türkiye", 1, "Turkey" => "turkey");
lookup!(TimorTable, TimorLeste, "Timor-Leste", 1, "EastTimor" => "easttimor");
lookup!(CzechiaTable, Czechia, "Czechia", 1, "CzechRepulic" => "czechrepublic");

/// Wrapper struct for alias tables to avoid using Box
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Eq, PartialEq, Ord, PartialOrd)]
Expand Down Expand Up @@ -333,7 +335,7 @@ pub enum CountryTable {
/// Aliases for FrenchSouthernTerritories
FrenchSouthernTerritories(FrenchSouthernTerritoriesTable),
/// Aliases for Gabmia
Gabmia(GabmiaTable),
Gambia(GambiaTable),
/// Aliases for HolySee
HolySee(HolySeeTable),
/// Aliases for LaoPeoplesDemocraticRepublic
Expand Down Expand Up @@ -372,6 +374,10 @@ pub enum CountryTable {
Tanzania(TanzaniaTable),
/// Aliases for Turkey
Turkey(TurkeyTable),
/// Aliases for TimorLeste
TimorLeste(TimorTable),
/// Aliases for Czechia
Czechia(CzechiaTable),
}

impl LookupTable for CountryTable {
Expand Down Expand Up @@ -412,7 +418,7 @@ impl LookupTable for CountryTable {
CountryTable::Malvinas(t) => t.contains(alias),
CountryTable::FaroeIslands(t) => t.contains(alias),
CountryTable::FrenchSouthernTerritories(t) => t.contains(alias),
CountryTable::Gabmia(t) => t.contains(alias),
CountryTable::Gambia(t) => t.contains(alias),
CountryTable::HolySee(t) => t.contains(alias),
CountryTable::LaoPeoplesDemocraticRepublic(t) => t.contains(alias),
CountryTable::MarshallIslands(t) => t.contains(alias),
Expand All @@ -432,6 +438,8 @@ impl LookupTable for CountryTable {
CountryTable::Trinidad(t) => t.contains(alias),
CountryTable::Tanzania(t) => t.contains(alias),
CountryTable::Turkey(t) => t.contains(alias),
CountryTable::TimorLeste(t) => t.contains(alias),
CountryTable::Czeckia(t) => t.contains(alias),
}
}

Expand Down Expand Up @@ -472,7 +480,7 @@ impl LookupTable for CountryTable {
CountryTable::Malvinas(t) => t.len(),
CountryTable::FaroeIslands(t) => t.len(),
CountryTable::FrenchSouthernTerritories(t) => t.len(),
CountryTable::Gabmia(t) => t.len(),
CountryTable::Gambia(t) => t.len(),
CountryTable::HolySee(t) => t.len(),
CountryTable::LaoPeoplesDemocraticRepublic(t) => t.len(),
CountryTable::MarshallIslands(t) => t.len(),
Expand All @@ -492,6 +500,8 @@ impl LookupTable for CountryTable {
CountryTable::Trinidad(t) => t.len(),
CountryTable::Tanzania(t) => t.len(),
CountryTable::Turkey(t) => t.len(),
CountryTable::TimorLeste(t) => t.len(),
CountryTable::Czeckia(t) => t.len(),
}
}

Expand Down Expand Up @@ -532,7 +542,7 @@ impl LookupTable for CountryTable {
CountryTable::Malvinas(t) => t.iter(),
CountryTable::FaroeIslands(t) => t.iter(),
CountryTable::FrenchSouthernTerritories(t) => t.iter(),
CountryTable::Gabmia(t) => t.iter(),
CountryTable::Gambia(t) => t.iter(),
CountryTable::HolySee(t) => t.iter(),
CountryTable::LaoPeoplesDemocraticRepublic(t) => t.iter(),
CountryTable::MarshallIslands(t) => t.iter(),
Expand All @@ -552,6 +562,8 @@ impl LookupTable for CountryTable {
CountryTable::Trinidad(t) => t.iter(),
CountryTable::Tanzania(t) => t.iter(),
CountryTable::Turkey(t) => t.iter(),
CountryTable::TimorLeste(t) => t.iter(),
CountryTable::Czeckia(t) => t.iter(),
}
}
}
Expand Down Expand Up @@ -594,7 +606,7 @@ impl fmt::Display for CountryTable {
CountryTable::Malvinas(t) => write!(f, "{}", t),
CountryTable::FaroeIslands(t) => write!(f, "{}", t),
CountryTable::FrenchSouthernTerritories(t) => write!(f, "{}", t),
CountryTable::Gabmia(t) => write!(f, "{}", t),
CountryTable::Gambia(t) => write!(f, "{}", t),
CountryTable::HolySee(t) => write!(f, "{}", t),
CountryTable::LaoPeoplesDemocraticRepublic(t) => write!(f, "{}", t),
CountryTable::MarshallIslands(t) => write!(f, "{}", t),
Expand All @@ -614,6 +626,8 @@ impl fmt::Display for CountryTable {
CountryTable::Trinidad(t) => write!(f, "{}", t),
CountryTable::Tanzania(t) => write!(f, "{}", t),
CountryTable::Turkey(t) => write!(f, "{}", t),
CountryTable::TimorLeste(t) => write!(f, "{}", t),
CountryTable::Czeckia(t) => write!(f, "{}", t),
}
}
}

0 comments on commit dbc139a

Please sign in to comment.