Skip to main content

celes/
lib.rs

1/*
2    Copyright Michael Lodder. All Rights Reserved.
3    SPDX-License-Identifier: Apache-2.0 OR MIT
4*/
5//! Rust implementation of Countries as specified by
6//! [Country Codes](https://www.iban.com/country-codes)
7//! and [ISO-3166-1](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
8//!
9//! If there are any countries missing then please let me know or submit a PR
10//!
11//! The main struct is `Country` which provides the following properties
12//!
13//! `code` - The three digit code for the country
14//! `value` - The code as an integer
15//! `alpha2` - The alpha2 letter set for the country
16//! `alpha3` - The alpha3 letter set for the country
17//! `long_name` - The official state name for the country
18//! `aliases` - Other names by which the country is known. For example,
19//! The Russian Federation is also called Russia or The United Kingdom of Great Britain
20//! and Northern Ireland is also called England, Great Britain,
21//! Northern Ireland, Scotland, and United Kingdom.
22//!
23//! Each country can be instantiated by using a function with the country name in snake case
24//!
25//! ## Usage
26//!
27//! ```
28//! use celes::Country;
29//!
30//!
31//!  let gb = Country::the_united_kingdom_of_great_britain_and_northern_ireland();
32//!  println!("{}", gb);
33//!
34//!  let usa = Country::the_united_states_of_america();
35//!  println!("{}", usa);
36//!
37//! ```
38//!
39//! Additionally, each country can be created from a string or its numeric code.
40//! `Country` provides multiple from methods to instantiate it from a string:
41//!
42//! - `from_code` - create `Country` from three digit code
43//! - `from_value` - create `Country` from the numeric code as an integer
44//! - `from_alpha2` - create `Country` from two letter code
45//! - `from_alpha3` - create `Country` from three letter code
46//! - `from_alias` - create `Country` from a common alias stripped of any spaces or
47//!   underscores. This only works for some countries as not all countries have aliases
48//! - `from_name` - create `Country` from the full state name no space or underscores
49//!
50//! `Country` implements the [core::str::FromStr](https://doc.rust-lang.org/core/str/trait.FromStr.html) trait that accepts any valid argument to the previously mentioned functions
51//! such as:
52//!
53//! - The country aliases like `UnitedKingdom`, `GreatBritain`, Russia, America
54//! - The full country name
55//! - The numeric code (e.g. "840")
56//! - The alpha2 code
57//! - The alpha3 code
58//!
59//! If you are uncertain which function to use, just use `Country::from_str` as it accepts
60//! any of the valid string values. `Country::from_str` is case-insensitive
61//!
62//! ## From String Example
63//!
64//! ```rust
65//! use celes::Country;
66//! use core::str::FromStr;
67//!
68//! // All of these are equivalent
69//! assert_eq!("US", Country::from_str("USA").unwrap().alpha2);
70//! assert_eq!("US", Country::from_str("US").unwrap().alpha2);
71//! assert_eq!("US", Country::from_str("America").unwrap().alpha2);
72//! assert_eq!("US", Country::from_str("UnitedStates").unwrap().alpha2);
73//! assert_eq!("US", Country::from_str("TheUnitedStatesOfAmerica").unwrap().alpha2);
74//!
75//! // All of these are equivalent
76//! assert_eq!("GB", Country::from_str("England").unwrap().alpha2);
77//! assert_eq!("GB", Country::from_str("gb").unwrap().alpha2);
78//! assert_eq!("GB", Country::from_str("Scotland").unwrap().alpha2);
79//! assert_eq!("GB", Country::from_str("TheUnitedKingdomOfGreatBritainAndNorthernIreland").unwrap().alpha2);
80//! ```
81
82mod tables;
83
84use core::{
85    cmp::Ordering,
86    fmt::{Debug, Display, Formatter, Result as FmtResult, Write},
87    hash::{Hash, Hasher},
88    str::FromStr,
89};
90use phf::{Map, phf_map};
91use serde::{
92    Deserialize, Deserializer, Serialize, Serializer,
93    de::{Error as DError, Visitor},
94};
95pub use tables::*;
96
97/// Perform a PHF map lookup with ASCII-lowercased input, avoiding heap allocation.
98/// Falls back to `str::to_lowercase` for non-ASCII input (e.g. "Türkiye").
99fn lookup_ascii_lowercase<'a, V>(map: &'a Map<&'static str, V>, key: &str) -> Option<&'a V> {
100    // Stack buffer large enough for the longest key in any map
101    // ("theunitedkingdomofgreatbritainandnorthernireland" = 48 chars)
102    let mut buf = [0u8; 64];
103    if key.len() <= buf.len() && key.is_ascii() {
104        let buf = &mut buf[..key.len()];
105        buf.copy_from_slice(key.as_bytes());
106        buf.make_ascii_lowercase();
107        // SAFETY: input was ASCII, ASCII lowercase is still valid UTF-8
108        let lowered = unsafe { core::str::from_utf8_unchecked(buf) };
109        map.get(lowered)
110    } else {
111        map.get(key.to_lowercase().as_str())
112    }
113}
114
115/// Creates the country function. Meant to be called inside `Country`
116macro_rules! country {
117    ($func:ident, $code:expr, $value:expr, $alpha2:expr, $alpha3:expr, $long_name:expr) => {
118        country!{ @gen [concat!("Creates a struct for ", $long_name), $func, $code, $value, $alpha2, $alpha3, $long_name] }
119    };
120    ($func:ident, $code:expr, $value:expr, $alpha2:expr, $alpha3:expr, $long_name:expr, $table:ident, $( $alias:expr  ),*) => {
121        country!{ @gen [concat!("Creates a struct for ", $long_name), $func, $code, $value, $alpha2, $alpha3, $long_name, $table, $( $alias ),* ] }
122    };
123    (@gen [$doc:expr, $func:ident, $code:expr, $value:expr, $alpha2:expr, $alpha3:expr, $long_name:expr]) => {
124        #[doc = $doc]
125        #[inline]
126        pub const fn $func() -> Self {
127            Self {
128                code: $code,
129                value: $value,
130                alpha2: $alpha2,
131                alpha3: $alpha3,
132                long_name: $long_name,
133                aliases: EMPTY_LOOKUP_TABLE.into_country_table(),
134            }
135        }
136    };
137    (@gen [$doc:expr, $func:ident, $code:expr, $value:expr, $alpha2:expr, $alpha3:expr, $long_name:expr, $table:ident, $( $alias:expr ),* ]) => {
138        #[doc = $doc]
139        #[inline]
140        pub const fn $func() -> Self {
141            Self {
142                code: $code,
143                value: $value,
144                alpha2: $alpha2,
145                alpha3: $alpha3,
146                long_name: $long_name,
147                aliases: $table::const_default().into_country_table()
148            }
149        }
150    };
151}
152
153/// Represents a country according to ISO 3166
154#[derive(Copy, Clone)]
155pub struct Country {
156    /// The three digit code assigned to the country
157    pub code: &'static str,
158    /// The integer value for `code`
159    pub value: usize,
160    /// The two letter country code (alpha-2) assigned to the country
161    pub alpha2: &'static str,
162    /// The three letter country code (alpha-3) assigned to the country
163    pub alpha3: &'static str,
164    /// The official state name of the country
165    pub long_name: &'static str,
166    /// Common aliases associated with the country
167    pub aliases: CountryTable,
168}
169
170impl Debug for Country {
171    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
172        write!(
173            f,
174            "Country {{ code: {}, value: {}, alpha2: {}, alpha3: {}, long_name: {}, aliases: {} }}",
175            self.code, self.value, self.alpha2, self.alpha3, self.long_name, self.aliases
176        )
177    }
178}
179
180impl Display for Country {
181    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
182        for c in self.long_name.chars() {
183            if c != ' ' {
184                f.write_char(c)?;
185            }
186        }
187        Ok(())
188    }
189}
190
191impl Ord for Country {
192    fn cmp(&self, other: &Self) -> Ordering {
193        self.long_name.cmp(other.long_name)
194    }
195}
196
197impl PartialOrd for Country {
198    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
199        Some(self.cmp(other))
200    }
201}
202
203impl Eq for Country {}
204
205impl PartialEq for Country {
206    fn eq(&self, other: &Self) -> bool {
207        self.value == other.value
208    }
209}
210
211impl Serialize for Country {
212    fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
213    where
214        S: Serializer,
215    {
216        s.serialize_str(self.alpha2)
217    }
218}
219
220impl<'de> Deserialize<'de> for Country {
221    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
222    where
223        D: Deserializer<'de>,
224    {
225        struct CountryVisitor;
226        impl Visitor<'_> for CountryVisitor {
227            type Value = Country;
228
229            fn expecting(&self, f: &mut Formatter<'_>) -> FmtResult {
230                write!(f, "a two letter string")
231            }
232
233            fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
234            where
235                E: DError,
236            {
237                Country::from_alpha2(s)
238                    .map_err(|_| DError::invalid_value(serde::de::Unexpected::Str(s), &self))
239            }
240        }
241
242        deserializer.deserialize_str(CountryVisitor)
243    }
244}
245
246impl Hash for Country {
247    fn hash<H: Hasher>(&self, state: &mut H) {
248        self.value.hash(state);
249    }
250}
251
252impl Country {
253    country!(afghanistan, "004", 4, "AF", "AFG", "Afghanistan");
254
255    country!(aland_islands, "248", 248, "AX", "ALA", "Aland Islands");
256
257    country!(albania, "008", 8, "AL", "ALB", "Albania");
258
259    country!(algeria, "012", 12, "DZ", "DZA", "Algeria");
260
261    country!(
262        american_samoa,
263        "016",
264        16,
265        "AS",
266        "ASM",
267        "American Samoa",
268        SamoaTable,
269        "Samoa"
270    );
271
272    country!(andorra, "020", 20, "AD", "AND", "Andorra");
273
274    country!(angola, "024", 24, "AO", "AGO", "Angola");
275
276    country!(anguilla, "660", 660, "AI", "AIA", "Anguilla");
277
278    country!(antarctica, "010", 10, "AQ", "ATA", "Antarctica");
279
280    country!(
281        antigua_and_barbuda,
282        "028",
283        28,
284        "AG",
285        "ATG",
286        "Antigua And Barbuda"
287    );
288
289    country!(argentina, "032", 32, "AR", "ARG", "Argentina");
290
291    country!(armenia, "051", 51, "AM", "ARM", "Armenia");
292
293    country!(aruba, "533", 533, "AW", "ABW", "Aruba");
294
295    country!(
296        ascension_and_tristan_da_cunha_saint_helena,
297        "654",
298        654,
299        "SH",
300        "SHN",
301        "Ascension And Tristan Da Cunha Saint Helena",
302        SaintHelenaTable,
303        "StHelena",
304        "SaintHelena"
305    );
306
307    country!(australia, "036", 36, "AU", "AUS", "Australia");
308
309    country!(austria, "040", 40, "AT", "AUT", "Austria");
310
311    country!(azerbaijan, "031", 31, "AZ", "AZE", "Azerbaijan");
312
313    country!(bahrain, "048", 48, "BH", "BHR", "Bahrain");
314
315    country!(bangladesh, "050", 50, "BD", "BGD", "Bangladesh");
316
317    country!(barbados, "052", 52, "BB", "BRB", "Barbados");
318
319    country!(belarus, "112", 112, "BY", "BLR", "Belarus");
320
321    country!(belgium, "056", 56, "BE", "BEL", "Belgium");
322
323    country!(belize, "084", 84, "BZ", "BLZ", "Belize");
324
325    country!(benin, "204", 204, "BJ", "BEN", "Benin");
326
327    country!(bermuda, "060", 60, "BM", "BMU", "Bermuda");
328
329    country!(bhutan, "064", 64, "BT", "BTN", "Bhutan");
330
331    country!(
332        bolivarian_republic_of_venezuela,
333        "862",
334        862,
335        "VE",
336        "VEN",
337        "Bolivarian Republic Of Venezuela",
338        VenezuelaTable,
339        "Venezuela"
340    );
341
342    country!(bolivia, "068", 68, "BO", "BOL", "Bolivia");
343
344    country!(bonaire, "535", 535, "BQ", "BES", "Bonaire");
345
346    country!(
347        bosnia_and_herzegovina,
348        "070",
349        70,
350        "BA",
351        "BIH",
352        "Bosnia And Herzegovina",
353        BosniaTable,
354        "Bosnia",
355        "Herzegovina"
356    );
357
358    country!(botswana, "072", 72, "BW", "BWA", "Botswana");
359
360    country!(bouvet_island, "074", 74, "BV", "BVT", "Bouvet Island");
361
362    country!(brazil, "076", 76, "BR", "BRA", "Brazil");
363
364    country!(
365        british_indian_ocean_territory,
366        "086",
367        86,
368        "IO",
369        "IOT",
370        "British Indian Ocean Territory"
371    );
372
373    country!(
374        british_virgin_islands,
375        "092",
376        92,
377        "VG",
378        "VGB",
379        "British Virgin Islands"
380    );
381
382    country!(
383        brunei_darussalam,
384        "096",
385        96,
386        "BN",
387        "BRN",
388        "Brunei Darussalam",
389        BruneiTable,
390        "Brunei"
391    );
392
393    country!(bulgaria, "100", 100, "BG", "BGR", "Bulgaria");
394
395    country!(
396        burkina_faso,
397        "854",
398        854,
399        "BF",
400        "BFA",
401        "Burkina Faso",
402        BurkinaTable,
403        "Burkina"
404    );
405
406    country!(burundi, "108", 108, "BI", "BDI", "Burundi");
407
408    country!(
409        cabo_verde,
410        "132",
411        132,
412        "CV",
413        "CPV",
414        "Cabo Verde",
415        CaboVerdeTable,
416        "CaboVerde",
417        "CapeVerde"
418    );
419
420    country!(cambodia, "116", 116, "KH", "KHM", "Cambodia");
421
422    country!(cameroon, "120", 120, "CM", "CMR", "Cameroon");
423
424    country!(canada, "124", 124, "CA", "CAN", "Canada");
425
426    country!(chad, "148", 148, "TD", "TCD", "Chad");
427
428    country!(chile, "152", 152, "CL", "CHL", "Chile");
429
430    country!(china, "156", 156, "CN", "CHN", "China");
431
432    country!(
433        christmas_island,
434        "162",
435        162,
436        "CX",
437        "CXR",
438        "Christmas Island"
439    );
440
441    country!(colombia, "170", 170, "CO", "COL", "Colombia");
442
443    country!(costa_rica, "188", 188, "CR", "CRI", "Costa Rica");
444
445    country!(
446        coted_ivoire,
447        "384",
448        384,
449        "CI",
450        "CIV",
451        "Coted Ivoire",
452        CoteDIvoireTable,
453        "CoteDIvoire",
454        "IvoryCoast"
455    );
456
457    country!(croatia, "191", 191, "HR", "HRV", "Croatia");
458
459    country!(cuba, "192", 192, "CU", "CUB", "Cuba");
460
461    country!(curacao, "531", 531, "CW", "CUW", "Curacao");
462
463    country!(cyprus, "196", 196, "CY", "CYP", "Cyprus");
464
465    country!(
466        czechia,
467        "203",
468        203,
469        "CZ",
470        "CZE",
471        "Czechia",
472        CzechiaTable,
473        "CzechRepublic"
474    );
475
476    country!(denmark, "208", 208, "DK", "DNK", "Denmark");
477
478    country!(djibouti, "262", 262, "DJ", "DJI", "Djibouti");
479
480    country!(dominica, "212", 212, "DM", "DMA", "Dominica");
481
482    country!(
483        dutch_part_sint_maarten,
484        "534",
485        534,
486        "SX",
487        "SXM",
488        "Dutch Part Sint Maarten",
489        StMaartenTable,
490        "StMaarten",
491        "SaintMaarten"
492    );
493
494    country!(ecuador, "218", 218, "EC", "ECU", "Ecuador");
495
496    country!(egypt, "818", 818, "EG", "EGY", "Egypt");
497
498    country!(el_salvador, "222", 222, "SV", "SLV", "El Salvador");
499
500    country!(
501        equatorial_guinea,
502        "226",
503        226,
504        "GQ",
505        "GNQ",
506        "Equatorial Guinea"
507    );
508
509    country!(eritrea, "232", 232, "ER", "ERI", "Eritrea");
510
511    country!(estonia, "233", 233, "EE", "EST", "Estonia");
512
513    country!(
514        eswatini,
515        "748",
516        748,
517        "SZ",
518        "SWZ",
519        "Eswatini",
520        EswatiniTable,
521        "Eswatini",
522        "Swaziland"
523    );
524
525    country!(ethiopia, "231", 231, "ET", "ETH", "Ethiopia");
526
527    country!(
528        federated_states_of_micronesia,
529        "583",
530        583,
531        "FM",
532        "FSM",
533        "Federated States Of Micronesia",
534        MicronesiaTable,
535        "Micronesia"
536    );
537
538    country!(fiji, "242", 242, "FJ", "FJI", "Fiji");
539
540    country!(finland, "246", 246, "FI", "FIN", "Finland");
541
542    country!(france, "250", 250, "FR", "FRA", "France");
543
544    country!(french_guiana, "254", 254, "GF", "GUF", "French Guiana");
545
546    country!(
547        french_part_saint_martin,
548        "663",
549        663,
550        "MF",
551        "MAF",
552        "French Part Saint Martin",
553        StMartinTable,
554        "StMartin",
555        "SaintMartin"
556    );
557
558    country!(
559        french_polynesia,
560        "258",
561        258,
562        "PF",
563        "PYF",
564        "French Polynesia"
565    );
566
567    country!(gabon, "266", 266, "GA", "GAB", "Gabon");
568
569    country!(georgia, "268", 268, "GE", "GEO", "Georgia");
570
571    country!(germany, "276", 276, "DE", "DEU", "Germany");
572
573    country!(ghana, "288", 288, "GH", "GHA", "Ghana");
574
575    country!(gibraltar, "292", 292, "GI", "GIB", "Gibraltar");
576
577    country!(greece, "300", 300, "GR", "GRC", "Greece");
578
579    country!(greenland, "304", 304, "GL", "GRL", "Greenland");
580
581    country!(grenada, "308", 308, "GD", "GRD", "Grenada");
582
583    country!(guadeloupe, "312", 312, "GP", "GLP", "Guadeloupe");
584
585    country!(guam, "316", 316, "GU", "GUM", "Guam");
586
587    country!(guatemala, "320", 320, "GT", "GTM", "Guatemala");
588
589    country!(guernsey, "831", 831, "GG", "GGY", "Guernsey");
590
591    country!(guinea, "324", 324, "GN", "GIN", "Guinea");
592
593    country!(guinea_bissau, "624", 624, "GW", "GNB", "Guinea Bissau");
594
595    country!(guyana, "328", 328, "GY", "GUY", "Guyana");
596
597    country!(haiti, "332", 332, "HT", "HTI", "Haiti");
598
599    country!(
600        heard_island_and_mc_donald_islands,
601        "334",
602        334,
603        "HM",
604        "HMD",
605        "Heard Island And Mc Donald Islands",
606        HeardIslandTable,
607        "HeardIsland",
608        "McDonaldIslands"
609    );
610
611    country!(honduras, "340", 340, "HN", "HND", "Honduras");
612
613    country!(hong_kong, "344", 344, "HK", "HKG", "Hong Kong");
614
615    country!(hungary, "348", 348, "HU", "HUN", "Hungary");
616
617    country!(iceland, "352", 352, "IS", "ISL", "Iceland");
618
619    country!(india, "356", 356, "IN", "IND", "India");
620
621    country!(indonesia, "360", 360, "ID", "IDN", "Indonesia");
622
623    country!(iraq, "368", 368, "IQ", "IRQ", "Iraq");
624
625    country!(ireland, "372", 372, "IE", "IRL", "Ireland");
626
627    country!(
628        islamic_republic_of_iran,
629        "364",
630        364,
631        "IR",
632        "IRN",
633        "Islamic Republic Of Iran",
634        IranTable,
635        "Iran"
636    );
637
638    country!(isle_of_man, "833", 833, "IM", "IMN", "Isle Of Man");
639
640    country!(israel, "376", 376, "IL", "ISR", "Israel");
641
642    country!(italy, "380", 380, "IT", "ITA", "Italy");
643
644    country!(jamaica, "388", 388, "JM", "JAM", "Jamaica");
645
646    country!(japan, "392", 392, "JP", "JPN", "Japan");
647
648    country!(jersey, "832", 832, "JE", "JEY", "Jersey");
649
650    country!(jordan, "400", 400, "JO", "JOR", "Jordan");
651
652    country!(kazakhstan, "398", 398, "KZ", "KAZ", "Kazakhstan");
653
654    country!(kenya, "404", 404, "KE", "KEN", "Kenya");
655
656    country!(kiribati, "296", 296, "KI", "KIR", "Kiribati");
657
658    country!(kosovo, "383", 383, "XK", "XKX", "Kosovo");
659
660    country!(kuwait, "414", 414, "KW", "KWT", "Kuwait");
661
662    country!(kyrgyzstan, "417", 417, "KG", "KGZ", "Kyrgyzstan");
663
664    country!(latvia, "428", 428, "LV", "LVA", "Latvia");
665
666    country!(lebanon, "422", 422, "LB", "LBN", "Lebanon");
667
668    country!(lesotho, "426", 426, "LS", "LSO", "Lesotho");
669
670    country!(liberia, "430", 430, "LR", "LBR", "Liberia");
671
672    country!(libya, "434", 434, "LY", "LBY", "Libya");
673
674    country!(liechtenstein, "438", 438, "LI", "LIE", "Liechtenstein");
675
676    country!(lithuania, "440", 440, "LT", "LTU", "Lithuania");
677
678    country!(luxembourg, "442", 442, "LU", "LUX", "Luxembourg");
679
680    country!(macao, "446", 446, "MO", "MAC", "Macao", MacauTable, "Macau");
681
682    country!(madagascar, "450", 450, "MG", "MDG", "Madagascar");
683
684    country!(malawi, "454", 454, "MW", "MWI", "Malawi");
685
686    country!(malaysia, "458", 458, "MY", "MYS", "Malaysia");
687
688    country!(maldives, "462", 462, "MV", "MDV", "Maldives");
689
690    country!(mali, "466", 466, "ML", "MLI", "Mali");
691
692    country!(malta, "470", 470, "MT", "MLT", "Malta");
693
694    country!(martinique, "474", 474, "MQ", "MTQ", "Martinique");
695
696    country!(mauritania, "478", 478, "MR", "MRT", "Mauritania");
697
698    country!(mauritius, "480", 480, "MU", "MUS", "Mauritius");
699
700    country!(mayotte, "175", 175, "YT", "MYT", "Mayotte");
701
702    country!(mexico, "484", 484, "MX", "MEX", "Mexico");
703
704    country!(monaco, "492", 492, "MC", "MCO", "Monaco");
705
706    country!(mongolia, "496", 496, "MN", "MNG", "Mongolia");
707
708    country!(montenegro, "499", 499, "ME", "MNE", "Montenegro");
709
710    country!(montserrat, "500", 500, "MS", "MSR", "Montserrat");
711
712    country!(morocco, "504", 504, "MA", "MAR", "Morocco");
713
714    country!(mozambique, "508", 508, "MZ", "MOZ", "Mozambique");
715
716    country!(
717        myanmar,
718        "104",
719        104,
720        "MM",
721        "MMR",
722        "Myanmar",
723        MyanmarTable,
724        "Myanmar",
725        "Burma"
726    );
727
728    country!(namibia, "516", 516, "NA", "NAM", "Namibia");
729
730    country!(nauru, "520", 520, "NR", "NRU", "Nauru");
731
732    country!(nepal, "524", 524, "NP", "NPL", "Nepal");
733
734    country!(new_caledonia, "540", 540, "NC", "NCL", "New Caledonia");
735
736    country!(new_zealand, "554", 554, "NZ", "NZL", "New Zealand");
737
738    country!(nicaragua, "558", 558, "NI", "NIC", "Nicaragua");
739
740    country!(nigeria, "566", 566, "NG", "NGA", "Nigeria");
741
742    country!(niue, "570", 570, "NU", "NIU", "Niue");
743
744    country!(norfolk_island, "574", 574, "NF", "NFK", "Norfolk Island");
745
746    country!(norway, "578", 578, "NO", "NOR", "Norway");
747
748    country!(oman, "512", 512, "OM", "OMN", "Oman");
749
750    country!(pakistan, "586", 586, "PK", "PAK", "Pakistan");
751
752    country!(palau, "585", 585, "PW", "PLW", "Palau");
753
754    country!(panama, "591", 591, "PA", "PAN", "Panama");
755
756    country!(
757        papua_new_guinea,
758        "598",
759        598,
760        "PG",
761        "PNG",
762        "Papua New Guinea"
763    );
764
765    country!(paraguay, "600", 600, "PY", "PRY", "Paraguay");
766
767    country!(peru, "604", 604, "PE", "PER", "Peru");
768
769    country!(pitcairn, "612", 612, "PN", "PCN", "Pitcairn");
770
771    country!(poland, "616", 616, "PL", "POL", "Poland");
772
773    country!(portugal, "620", 620, "PT", "PRT", "Portugal");
774
775    country!(puerto_rico, "630", 630, "PR", "PRI", "Puerto Rico");
776
777    country!(qatar, "634", 634, "QA", "QAT", "Qatar");
778
779    country!(
780        republic_of_north_macedonia,
781        "807",
782        807,
783        "MK",
784        "MKD",
785        "Republic Of North Macedonia",
786        NorthMacedoniaTable,
787        "NorthMacedonia",
788        "Macedonia"
789    );
790
791    country!(reunion, "638", 638, "RE", "REU", "Reunion");
792
793    country!(romania, "642", 642, "RO", "ROU", "Romania");
794
795    country!(rwanda, "646", 646, "RW", "RWA", "Rwanda");
796
797    country!(
798        saint_barthelemy,
799        "652",
800        652,
801        "BL",
802        "BLM",
803        "Saint Barthelemy",
804        StBarthelemyTable,
805        "StBarthelemy"
806    );
807
808    country!(
809        saint_kitts_and_nevis,
810        "659",
811        659,
812        "KN",
813        "KNA",
814        "Saint Kitts And Nevis",
815        StKittsTable,
816        "StKitts"
817    );
818
819    country!(
820        saint_lucia,
821        "662",
822        662,
823        "LC",
824        "LCA",
825        "Saint Lucia",
826        StLuciaTable,
827        "StLucia"
828    );
829
830    country!(
831        saint_pierre_and_miquelon,
832        "666",
833        666,
834        "PM",
835        "SPM",
836        "Saint Pierre And Miquelon",
837        StPierreTable,
838        "StPierre",
839        "SaintPierre"
840    );
841
842    country!(
843        saint_vincent_and_the_grenadines,
844        "670",
845        670,
846        "VC",
847        "VCT",
848        "Saint Vincent And The Grenadines",
849        StVincentTable,
850        "StVincent",
851        "SaintVincent"
852    );
853
854    country!(samoa, "882", 882, "WS", "WSM", "Samoa");
855
856    country!(san_marino, "674", 674, "SM", "SMR", "San Marino");
857
858    country!(
859        sao_tome_and_principe,
860        "678",
861        678,
862        "ST",
863        "STP",
864        "Sao Tome And Principe",
865        SaoTomeTable,
866        "SaoTome"
867    );
868
869    country!(saudi_arabia, "682", 682, "SA", "SAU", "Saudi Arabia");
870
871    country!(senegal, "686", 686, "SN", "SEN", "Senegal");
872
873    country!(serbia, "688", 688, "RS", "SRB", "Serbia");
874
875    country!(seychelles, "690", 690, "SC", "SYC", "Seychelles");
876
877    country!(sierra_leone, "694", 694, "SL", "SLE", "Sierra Leone");
878
879    country!(singapore, "702", 702, "SG", "SGP", "Singapore");
880
881    country!(slovakia, "703", 703, "SK", "SVK", "Slovakia");
882
883    country!(slovenia, "705", 705, "SI", "SVN", "Slovenia");
884
885    country!(solomon_islands, "090", 90, "SB", "SLB", "Solomon Islands");
886
887    country!(somalia, "706", 706, "SO", "SOM", "Somalia");
888
889    country!(south_africa, "710", 710, "ZA", "ZAF", "South Africa");
890
891    country!(
892        south_georgia_and_the_south_sandwich_islands,
893        "239",
894        239,
895        "GS",
896        "SGS",
897        "South Georgia And The South Sandwich Islands",
898        SouthGeorgiaTable,
899        "SouthGeorgia",
900        "SouthSandwichIslands"
901    );
902
903    country!(south_sudan, "728", 728, "SS", "SSD", "South Sudan");
904
905    country!(spain, "724", 724, "ES", "ESP", "Spain");
906
907    country!(sri_lanka, "144", 144, "LK", "LKA", "Sri Lanka");
908
909    country!(
910        state_of_palestine,
911        "275",
912        275,
913        "PS",
914        "PSE",
915        "State Of Palestine",
916        PalestineTable,
917        "Palestine"
918    );
919
920    country!(suriname, "740", 740, "SR", "SUR", "Suriname");
921
922    country!(
923        svalbard_and_jan_mayen,
924        "744",
925        744,
926        "SJ",
927        "SJM",
928        "Svalbard And Jan Mayen"
929    );
930
931    country!(sweden, "752", 752, "SE", "SWE", "Sweden");
932
933    country!(switzerland, "756", 756, "CH", "CHE", "Switzerland");
934
935    country!(
936        syrian_arab_republic,
937        "760",
938        760,
939        "SY",
940        "SYR",
941        "Syrian Arab Republic",
942        SyriaTable,
943        "Syria"
944    );
945
946    country!(
947        taiwan,
948        "158",
949        158,
950        "TW",
951        "TWN",
952        "Taiwan, Republic Of China",
953        TaiwanTable,
954        "Taiwan",
955        "台灣",
956        "Republic of China",
957        "中華民國"
958    );
959
960    country!(tajikistan, "762", 762, "TJ", "TJK", "Tajikistan");
961
962    country!(thailand, "764", 764, "TH", "THA", "Thailand");
963
964    country!(
965        the_bahamas,
966        "044",
967        44,
968        "BS",
969        "BHS",
970        "The Bahamas",
971        BahamasTable,
972        "Bahamas"
973    );
974
975    country!(
976        the_cayman_islands,
977        "136",
978        136,
979        "KY",
980        "CYM",
981        "The Cayman Islands",
982        CaymanIslandsTable,
983        "CaymanIslands"
984    );
985
986    country!(
987        the_central_african_republic,
988        "140",
989        140,
990        "CF",
991        "CAF",
992        "The Central African Republic",
993        CentralAfricanRepublicTable,
994        "CentralAfricanRepublic"
995    );
996
997    country!(
998        the_cocos_keeling_islands,
999        "166",
1000        166,
1001        "CC",
1002        "CCK",
1003        "The Cocos Keeling Islands",
1004        CocosIslandsTable,
1005        "CocosIslands",
1006        "KeelingIslands"
1007    );
1008
1009    country!(
1010        the_comoros,
1011        "174",
1012        174,
1013        "KM",
1014        "COM",
1015        "The Comoros",
1016        ComorosTable,
1017        "Comoros"
1018    );
1019
1020    country!(
1021        the_congo,
1022        "178",
1023        178,
1024        "CG",
1025        "COG",
1026        "The Congo",
1027        CongoTable,
1028        "Congo"
1029    );
1030
1031    country!(
1032        the_cook_islands,
1033        "184",
1034        184,
1035        "CK",
1036        "COK",
1037        "The Cook Islands",
1038        CookIslandsTable,
1039        "CookIslands"
1040    );
1041
1042    country!(
1043        the_democratic_peoples_republic_of_korea,
1044        "408",
1045        408,
1046        "KP",
1047        "PRK",
1048        "The Democratic Peoples Republic Of Korea",
1049        NorthKoreaTable,
1050        "NorthKorea",
1051        "DemocraticPeoplesRepublicOfKorea"
1052    );
1053
1054    country!(
1055        the_democratic_republic_of_the_congo,
1056        "180",
1057        180,
1058        "CD",
1059        "COD",
1060        "The Democratic Republic Of The Congo",
1061        DemocraticRepublicOfTheCongoTable,
1062        "DemocraticRepublicOfTheCongo"
1063    );
1064
1065    country!(
1066        the_dominican_republic,
1067        "214",
1068        214,
1069        "DO",
1070        "DOM",
1071        "The Dominican Republic",
1072        DominicanRepublicTable,
1073        "DominicanRepublic"
1074    );
1075
1076    country!(
1077        the_falkland_islands_malvinas,
1078        "238",
1079        238,
1080        "FK",
1081        "FLK",
1082        "The Falkland Islands Malvinas",
1083        MalvinasTable,
1084        "Malvinas",
1085        "FalklandIslands"
1086    );
1087
1088    country!(
1089        the_faroe_islands,
1090        "234",
1091        234,
1092        "FO",
1093        "FRO",
1094        "The Faroe Islands",
1095        FaroeIslandsTable,
1096        "FaroeIslands"
1097    );
1098
1099    country!(
1100        the_french_southern_territories,
1101        "260",
1102        260,
1103        "TF",
1104        "ATF",
1105        "The French Southern Territories",
1106        FrenchSouthernTerritoriesTable,
1107        "FrenchSouthernTerritories"
1108    );
1109
1110    country!(
1111        the_gambia,
1112        "270",
1113        270,
1114        "GM",
1115        "GMB",
1116        "The Gambia",
1117        GambiaTable,
1118        "Gambia"
1119    );
1120
1121    country!(
1122        the_holy_see,
1123        "336",
1124        336,
1125        "VA",
1126        "VAT",
1127        "The Holy See",
1128        HolySeeTable,
1129        "HolySee",
1130        "Vatican",
1131        "VaticanCity"
1132    );
1133
1134    country!(
1135        the_lao_peoples_democratic_republic,
1136        "418",
1137        418,
1138        "LA",
1139        "LAO",
1140        "The Lao Peoples Democratic Republic",
1141        LaoPeoplesDemocraticRepublicTable,
1142        "LaoPeoplesDemocraticRepublic",
1143        "Laos"
1144    );
1145
1146    country!(
1147        the_marshall_islands,
1148        "584",
1149        584,
1150        "MH",
1151        "MHL",
1152        "The Marshall Islands",
1153        MarshallIslandsTable,
1154        "MarshallIslands"
1155    );
1156
1157    country!(
1158        the_netherlands,
1159        "528",
1160        528,
1161        "NL",
1162        "NLD",
1163        "The Netherlands",
1164        NetherlandsTable,
1165        "Netherlands",
1166        "Holland"
1167    );
1168
1169    country!(
1170        the_niger,
1171        "562",
1172        562,
1173        "NE",
1174        "NER",
1175        "The Niger",
1176        NigerTable,
1177        "Niger"
1178    );
1179
1180    country!(
1181        the_northern_mariana_islands,
1182        "580",
1183        580,
1184        "MP",
1185        "MNP",
1186        "The Northern Mariana Islands",
1187        NorthernMarianaIslandsTable,
1188        "NorthernMarianaIslands"
1189    );
1190
1191    country!(
1192        the_philippines,
1193        "608",
1194        608,
1195        "PH",
1196        "PHL",
1197        "The Philippines",
1198        PhilippinesTable,
1199        "Philippines"
1200    );
1201
1202    country!(
1203        the_republic_of_korea,
1204        "410",
1205        410,
1206        "KR",
1207        "KOR",
1208        "The Republic Of Korea",
1209        SouthKoreaTable,
1210        "SouthKorea",
1211        "RepublicOfKorea"
1212    );
1213
1214    country!(
1215        the_republic_of_moldova,
1216        "498",
1217        498,
1218        "MD",
1219        "MDA",
1220        "The Republic Of Moldova",
1221        MoldovaTable,
1222        "Moldova",
1223        "RepublicOfMoldova"
1224    );
1225
1226    country!(
1227        the_russian_federation,
1228        "643",
1229        643,
1230        "RU",
1231        "RUS",
1232        "The Russian Federation",
1233        RussiaTable,
1234        "Russia",
1235        "RussianFederation"
1236    );
1237
1238    country!(
1239        the_sudan,
1240        "729",
1241        729,
1242        "SD",
1243        "SDN",
1244        "The Sudan",
1245        SudanTable,
1246        "Sudan"
1247    );
1248
1249    country!(
1250        the_turks_and_caicos_islands,
1251        "796",
1252        796,
1253        "TC",
1254        "TCA",
1255        "The Turks And Caicos Islands",
1256        TurksAndCaicosIslandsTable,
1257        "TurksAndCaicosIslands"
1258    );
1259
1260    country!(
1261        the_united_arab_emirates,
1262        "784",
1263        784,
1264        "AE",
1265        "ARE",
1266        "The United Arab Emirates",
1267        UnitedArabEmiratesTable,
1268        "UnitedArabEmirates"
1269    );
1270
1271    country!(
1272        the_united_kingdom_of_great_britain_and_northern_ireland,
1273        "826",
1274        826,
1275        "GB",
1276        "GBR",
1277        "The United Kingdom Of Great Britain And Northern Ireland",
1278        EnglandTable,
1279        "England",
1280        "Scotland",
1281        "GreatBritain",
1282        "UnitedKingdom",
1283        "NorthernIreland",
1284        "UnitedKingdomOfGreatBritain",
1285        "UnitedKingdomOfGreatBritainAndNorthernIreland"
1286    );
1287
1288    country!(
1289        the_united_states_minor_outlying_islands,
1290        "581",
1291        581,
1292        "UM",
1293        "UMI",
1294        "The United States Minor Outlying Islands",
1295        UnitedStatesMinorOutlyingIslandsTable,
1296        "UnitedStatesMinorOutlyingIslands"
1297    );
1298
1299    country!(
1300        the_united_states_of_america,
1301        "840",
1302        840,
1303        "US",
1304        "USA",
1305        "The United States Of America",
1306        AmericaTable,
1307        "America",
1308        "UnitedStates",
1309        "UnitedStatesOfAmerica"
1310    );
1311
1312    country!(
1313        timor_leste,
1314        "626",
1315        626,
1316        "TL",
1317        "TLS",
1318        "Timor Leste",
1319        TimorTable,
1320        "EastTimor"
1321    );
1322
1323    country!(togo, "768", 768, "TG", "TGO", "Togo");
1324
1325    country!(tokelau, "772", 772, "TK", "TKL", "Tokelau");
1326
1327    country!(tonga, "776", 776, "TO", "TON", "Tonga");
1328
1329    country!(
1330        trinidad_and_tobago,
1331        "780",
1332        780,
1333        "TT",
1334        "TTO",
1335        "Trinidad And Tobago",
1336        TrinidadTable,
1337        "Trinidad",
1338        "Tobago"
1339    );
1340
1341    country!(tunisia, "788", 788, "TN", "TUN", "Tunisia");
1342
1343    country!(
1344        turkey,
1345        "792",
1346        792,
1347        "TR",
1348        "TUR",
1349        "Türkiye",
1350        TurkiyeTable,
1351        "Turkiye",
1352        "Turkey"
1353    );
1354
1355    country!(turkmenistan, "795", 795, "TM", "TKM", "Turkmenistan");
1356
1357    country!(tuvalu, "798", 798, "TV", "TUV", "Tuvalu");
1358
1359    country!(
1360        us_virgin_islands,
1361        "850",
1362        850,
1363        "VI",
1364        "VIR",
1365        "US Virgin Islands"
1366    );
1367
1368    country!(uganda, "800", 800, "UG", "UGA", "Uganda");
1369
1370    country!(ukraine, "804", 804, "UA", "UKR", "Ukraine");
1371
1372    country!(
1373        united_republic_of_tanzania,
1374        "834",
1375        834,
1376        "TZ",
1377        "TZA",
1378        "United Republic Of Tanzania",
1379        TanzaniaTable,
1380        "Tanzania"
1381    );
1382
1383    country!(uruguay, "858", 858, "UY", "URY", "Uruguay");
1384
1385    country!(uzbekistan, "860", 860, "UZ", "UZB", "Uzbekistan");
1386
1387    country!(vanuatu, "548", 548, "VU", "VUT", "Vanuatu");
1388
1389    country!(vietnam, "704", 704, "VN", "VNM", "Vietnam");
1390
1391    country!(
1392        wallis_and_futuna,
1393        "876",
1394        876,
1395        "WF",
1396        "WLF",
1397        "Wallis And Futuna"
1398    );
1399
1400    country!(western_sahara, "732", 732, "EH", "ESH", "Western Sahara");
1401
1402    country!(yemen, "887", 887, "YE", "YEM", "Yemen");
1403
1404    country!(zambia, "894", 894, "ZM", "ZMB", "Zambia");
1405
1406    country!(zimbabwe, "716", 716, "ZW", "ZWE", "Zimbabwe");
1407
1408    /// Returns a vector in alphabetic order of all the countries
1409    ///
1410    /// ```
1411    /// use celes::Country;
1412    /// use std::collections::BTreeMap;
1413    ///
1414    /// let countries = Country::get_countries();
1415    ///
1416    ///
1417    /// for c in &countries {
1418    ///     println!("{}", c);
1419    /// }
1420    ///
1421    /// for c in &countries {
1422    ///     println!("{}", c.alpha2);
1423    /// }
1424    ///
1425    /// for c in countries.iter().filter(|cty| cty.value < 300) {
1426    ///     println!("{}", c.long_name)
1427    /// }
1428    ///
1429    /// //Convert to a map
1430    /// let lookup = countries.iter().map(|cty| (cty.alpha2.to_string(), cty.clone())).collect::<BTreeMap<String, Country>>();
1431    ///
1432    /// ```
1433    #[must_use]
1434    #[allow(clippy::too_many_lines, clippy::large_stack_arrays)]
1435    pub const fn get_countries() -> [Self; 250] {
1436        [
1437            Self::afghanistan(),
1438            Self::aland_islands(),
1439            Self::albania(),
1440            Self::algeria(),
1441            Self::american_samoa(),
1442            Self::andorra(),
1443            Self::angola(),
1444            Self::anguilla(),
1445            Self::antarctica(),
1446            Self::antigua_and_barbuda(),
1447            Self::argentina(),
1448            Self::armenia(),
1449            Self::aruba(),
1450            Self::ascension_and_tristan_da_cunha_saint_helena(),
1451            Self::australia(),
1452            Self::austria(),
1453            Self::azerbaijan(),
1454            Self::bahrain(),
1455            Self::bangladesh(),
1456            Self::barbados(),
1457            Self::belarus(),
1458            Self::belgium(),
1459            Self::belize(),
1460            Self::benin(),
1461            Self::bermuda(),
1462            Self::bhutan(),
1463            Self::bolivarian_republic_of_venezuela(),
1464            Self::bolivia(),
1465            Self::bonaire(),
1466            Self::bosnia_and_herzegovina(),
1467            Self::botswana(),
1468            Self::bouvet_island(),
1469            Self::brazil(),
1470            Self::british_indian_ocean_territory(),
1471            Self::british_virgin_islands(),
1472            Self::brunei_darussalam(),
1473            Self::bulgaria(),
1474            Self::burkina_faso(),
1475            Self::burundi(),
1476            Self::cabo_verde(),
1477            Self::cambodia(),
1478            Self::cameroon(),
1479            Self::canada(),
1480            Self::chad(),
1481            Self::chile(),
1482            Self::china(),
1483            Self::christmas_island(),
1484            Self::colombia(),
1485            Self::costa_rica(),
1486            Self::coted_ivoire(),
1487            Self::croatia(),
1488            Self::cuba(),
1489            Self::curacao(),
1490            Self::cyprus(),
1491            Self::czechia(),
1492            Self::denmark(),
1493            Self::djibouti(),
1494            Self::dominica(),
1495            Self::dutch_part_sint_maarten(),
1496            Self::ecuador(),
1497            Self::egypt(),
1498            Self::el_salvador(),
1499            Self::equatorial_guinea(),
1500            Self::eritrea(),
1501            Self::estonia(),
1502            Self::eswatini(),
1503            Self::ethiopia(),
1504            Self::federated_states_of_micronesia(),
1505            Self::fiji(),
1506            Self::finland(),
1507            Self::france(),
1508            Self::french_guiana(),
1509            Self::french_part_saint_martin(),
1510            Self::french_polynesia(),
1511            Self::gabon(),
1512            Self::georgia(),
1513            Self::germany(),
1514            Self::ghana(),
1515            Self::gibraltar(),
1516            Self::greece(),
1517            Self::greenland(),
1518            Self::grenada(),
1519            Self::guadeloupe(),
1520            Self::guam(),
1521            Self::guatemala(),
1522            Self::guernsey(),
1523            Self::guinea(),
1524            Self::guinea_bissau(),
1525            Self::guyana(),
1526            Self::haiti(),
1527            Self::heard_island_and_mc_donald_islands(),
1528            Self::honduras(),
1529            Self::hong_kong(),
1530            Self::hungary(),
1531            Self::iceland(),
1532            Self::india(),
1533            Self::indonesia(),
1534            Self::iraq(),
1535            Self::ireland(),
1536            Self::islamic_republic_of_iran(),
1537            Self::isle_of_man(),
1538            Self::israel(),
1539            Self::italy(),
1540            Self::jamaica(),
1541            Self::japan(),
1542            Self::jersey(),
1543            Self::jordan(),
1544            Self::kazakhstan(),
1545            Self::kenya(),
1546            Self::kiribati(),
1547            Self::kosovo(),
1548            Self::kuwait(),
1549            Self::kyrgyzstan(),
1550            Self::latvia(),
1551            Self::lebanon(),
1552            Self::lesotho(),
1553            Self::liberia(),
1554            Self::libya(),
1555            Self::liechtenstein(),
1556            Self::lithuania(),
1557            Self::luxembourg(),
1558            Self::macao(),
1559            Self::madagascar(),
1560            Self::malawi(),
1561            Self::malaysia(),
1562            Self::maldives(),
1563            Self::mali(),
1564            Self::malta(),
1565            Self::martinique(),
1566            Self::mauritania(),
1567            Self::mauritius(),
1568            Self::mayotte(),
1569            Self::mexico(),
1570            Self::monaco(),
1571            Self::mongolia(),
1572            Self::montenegro(),
1573            Self::montserrat(),
1574            Self::morocco(),
1575            Self::mozambique(),
1576            Self::myanmar(),
1577            Self::namibia(),
1578            Self::nauru(),
1579            Self::nepal(),
1580            Self::new_caledonia(),
1581            Self::new_zealand(),
1582            Self::nicaragua(),
1583            Self::nigeria(),
1584            Self::niue(),
1585            Self::norfolk_island(),
1586            Self::norway(),
1587            Self::oman(),
1588            Self::pakistan(),
1589            Self::palau(),
1590            Self::panama(),
1591            Self::papua_new_guinea(),
1592            Self::paraguay(),
1593            Self::peru(),
1594            Self::pitcairn(),
1595            Self::poland(),
1596            Self::portugal(),
1597            Self::puerto_rico(),
1598            Self::qatar(),
1599            Self::republic_of_north_macedonia(),
1600            Self::reunion(),
1601            Self::romania(),
1602            Self::rwanda(),
1603            Self::saint_barthelemy(),
1604            Self::saint_kitts_and_nevis(),
1605            Self::saint_lucia(),
1606            Self::saint_pierre_and_miquelon(),
1607            Self::saint_vincent_and_the_grenadines(),
1608            Self::samoa(),
1609            Self::san_marino(),
1610            Self::sao_tome_and_principe(),
1611            Self::saudi_arabia(),
1612            Self::senegal(),
1613            Self::serbia(),
1614            Self::seychelles(),
1615            Self::sierra_leone(),
1616            Self::singapore(),
1617            Self::slovakia(),
1618            Self::slovenia(),
1619            Self::solomon_islands(),
1620            Self::somalia(),
1621            Self::south_africa(),
1622            Self::south_georgia_and_the_south_sandwich_islands(),
1623            Self::south_sudan(),
1624            Self::spain(),
1625            Self::sri_lanka(),
1626            Self::state_of_palestine(),
1627            Self::suriname(),
1628            Self::svalbard_and_jan_mayen(),
1629            Self::sweden(),
1630            Self::switzerland(),
1631            Self::syrian_arab_republic(),
1632            Self::taiwan(),
1633            Self::tajikistan(),
1634            Self::thailand(),
1635            Self::the_bahamas(),
1636            Self::the_cayman_islands(),
1637            Self::the_central_african_republic(),
1638            Self::the_cocos_keeling_islands(),
1639            Self::the_comoros(),
1640            Self::the_congo(),
1641            Self::the_cook_islands(),
1642            Self::the_democratic_peoples_republic_of_korea(),
1643            Self::the_democratic_republic_of_the_congo(),
1644            Self::the_dominican_republic(),
1645            Self::the_falkland_islands_malvinas(),
1646            Self::the_faroe_islands(),
1647            Self::the_french_southern_territories(),
1648            Self::the_gambia(),
1649            Self::the_holy_see(),
1650            Self::the_lao_peoples_democratic_republic(),
1651            Self::the_marshall_islands(),
1652            Self::the_netherlands(),
1653            Self::the_niger(),
1654            Self::the_northern_mariana_islands(),
1655            Self::the_philippines(),
1656            Self::the_republic_of_korea(),
1657            Self::the_republic_of_moldova(),
1658            Self::the_russian_federation(),
1659            Self::the_sudan(),
1660            Self::the_turks_and_caicos_islands(),
1661            Self::the_united_arab_emirates(),
1662            Self::the_united_kingdom_of_great_britain_and_northern_ireland(),
1663            Self::the_united_states_minor_outlying_islands(),
1664            Self::the_united_states_of_america(),
1665            Self::timor_leste(),
1666            Self::togo(),
1667            Self::tokelau(),
1668            Self::tonga(),
1669            Self::trinidad_and_tobago(),
1670            Self::tunisia(),
1671            Self::turkey(),
1672            Self::turkmenistan(),
1673            Self::tuvalu(),
1674            Self::us_virgin_islands(),
1675            Self::uganda(),
1676            Self::ukraine(),
1677            Self::united_republic_of_tanzania(),
1678            Self::uruguay(),
1679            Self::uzbekistan(),
1680            Self::vanuatu(),
1681            Self::vietnam(),
1682            Self::wallis_and_futuna(),
1683            Self::western_sahara(),
1684            Self::yemen(),
1685            Self::zambia(),
1686            Self::zimbabwe(),
1687        ]
1688    }
1689
1690    /// Given the numeric code, return a country or an error if
1691    /// the parameter doesn't match any country
1692    ///
1693    /// # Errors
1694    ///
1695    /// Returns an error if the value does not match any known country code.
1696    ///
1697    /// ```
1698    /// use celes::Country;
1699    ///
1700    /// let res = Country::from_value(1);
1701    /// assert!(res.is_err());
1702    ///
1703    /// let res = Country::from_value(2);
1704    /// assert!(res.is_err());
1705    ///
1706    /// let res = Country::from_value(4);
1707    /// assert!(res.is_ok());
1708    ///
1709    /// assert_eq!(Country::afghanistan(), res.unwrap());
1710    /// ```
1711    #[allow(clippy::too_many_lines)]
1712    pub fn from_value(value: usize) -> Result<Self, &'static str> {
1713        static VALUES: Map<usize, Country> = phf_map! {
1714            4usize => Country::afghanistan(),
1715            248usize => Country::aland_islands(),
1716            8usize => Country::albania(),
1717            12usize => Country::algeria(),
1718            16usize => Country::american_samoa(),
1719            20usize => Country::andorra(),
1720            24usize => Country::angola(),
1721            660usize => Country::anguilla(),
1722            10usize => Country::antarctica(),
1723            28usize => Country::antigua_and_barbuda(),
1724            32usize => Country::argentina(),
1725            51usize => Country::armenia(),
1726            533usize => Country::aruba(),
1727            654usize => Country::ascension_and_tristan_da_cunha_saint_helena(),
1728            36usize => Country::australia(),
1729            40usize => Country::austria(),
1730            31usize => Country::azerbaijan(),
1731            48usize => Country::bahrain(),
1732            50usize => Country::bangladesh(),
1733            52usize => Country::barbados(),
1734            112usize => Country::belarus(),
1735            56usize => Country::belgium(),
1736            84usize => Country::belize(),
1737            204usize => Country::benin(),
1738            60usize => Country::bermuda(),
1739            64usize => Country::bhutan(),
1740            862usize => Country::bolivarian_republic_of_venezuela(),
1741            68usize => Country::bolivia(),
1742            535usize => Country::bonaire(),
1743            70usize => Country::bosnia_and_herzegovina(),
1744            72usize => Country::botswana(),
1745            74usize => Country::bouvet_island(),
1746            76usize => Country::brazil(),
1747            86usize => Country::british_indian_ocean_territory(),
1748            92usize => Country::british_virgin_islands(),
1749            96usize => Country::brunei_darussalam(),
1750            100usize => Country::bulgaria(),
1751            854usize => Country::burkina_faso(),
1752            108usize => Country::burundi(),
1753            132usize => Country::cabo_verde(),
1754            116usize => Country::cambodia(),
1755            120usize => Country::cameroon(),
1756            124usize => Country::canada(),
1757            148usize => Country::chad(),
1758            152usize => Country::chile(),
1759            156usize => Country::china(),
1760            162usize => Country::christmas_island(),
1761            170usize => Country::colombia(),
1762            188usize => Country::costa_rica(),
1763            384usize => Country::coted_ivoire(),
1764            191usize => Country::croatia(),
1765            192usize => Country::cuba(),
1766            531usize => Country::curacao(),
1767            196usize => Country::cyprus(),
1768            203usize => Country::czechia(),
1769            208usize => Country::denmark(),
1770            262usize => Country::djibouti(),
1771            212usize => Country::dominica(),
1772            534usize => Country::dutch_part_sint_maarten(),
1773            218usize => Country::ecuador(),
1774            818usize => Country::egypt(),
1775            222usize => Country::el_salvador(),
1776            226usize => Country::equatorial_guinea(),
1777            232usize => Country::eritrea(),
1778            233usize => Country::estonia(),
1779            748usize => Country::eswatini(),
1780            231usize => Country::ethiopia(),
1781            583usize => Country::federated_states_of_micronesia(),
1782            242usize => Country::fiji(),
1783            246usize => Country::finland(),
1784            250usize => Country::france(),
1785            254usize => Country::french_guiana(),
1786            663usize => Country::french_part_saint_martin(),
1787            258usize => Country::french_polynesia(),
1788            266usize => Country::gabon(),
1789            268usize => Country::georgia(),
1790            276usize => Country::germany(),
1791            288usize => Country::ghana(),
1792            292usize => Country::gibraltar(),
1793            300usize => Country::greece(),
1794            304usize => Country::greenland(),
1795            308usize => Country::grenada(),
1796            312usize => Country::guadeloupe(),
1797            316usize => Country::guam(),
1798            320usize => Country::guatemala(),
1799            831usize => Country::guernsey(),
1800            324usize => Country::guinea(),
1801            624usize => Country::guinea_bissau(),
1802            328usize => Country::guyana(),
1803            332usize => Country::haiti(),
1804            334usize => Country::heard_island_and_mc_donald_islands(),
1805            340usize => Country::honduras(),
1806            344usize => Country::hong_kong(),
1807            348usize => Country::hungary(),
1808            352usize => Country::iceland(),
1809            356usize => Country::india(),
1810            360usize => Country::indonesia(),
1811            368usize => Country::iraq(),
1812            372usize => Country::ireland(),
1813            364usize => Country::islamic_republic_of_iran(),
1814            833usize => Country::isle_of_man(),
1815            376usize => Country::israel(),
1816            380usize => Country::italy(),
1817            388usize => Country::jamaica(),
1818            392usize => Country::japan(),
1819            832usize => Country::jersey(),
1820            400usize => Country::jordan(),
1821            398usize => Country::kazakhstan(),
1822            404usize => Country::kenya(),
1823            296usize => Country::kiribati(),
1824            383usize => Country::kosovo(),
1825            414usize => Country::kuwait(),
1826            417usize => Country::kyrgyzstan(),
1827            428usize => Country::latvia(),
1828            422usize => Country::lebanon(),
1829            426usize => Country::lesotho(),
1830            430usize => Country::liberia(),
1831            434usize => Country::libya(),
1832            438usize => Country::liechtenstein(),
1833            440usize => Country::lithuania(),
1834            442usize => Country::luxembourg(),
1835            446usize => Country::macao(),
1836            450usize => Country::madagascar(),
1837            454usize => Country::malawi(),
1838            458usize => Country::malaysia(),
1839            462usize => Country::maldives(),
1840            466usize => Country::mali(),
1841            470usize => Country::malta(),
1842            474usize => Country::martinique(),
1843            478usize => Country::mauritania(),
1844            480usize => Country::mauritius(),
1845            175usize => Country::mayotte(),
1846            484usize => Country::mexico(),
1847            492usize => Country::monaco(),
1848            496usize => Country::mongolia(),
1849            499usize => Country::montenegro(),
1850            500usize => Country::montserrat(),
1851            504usize => Country::morocco(),
1852            508usize => Country::mozambique(),
1853            104usize => Country::myanmar(),
1854            516usize => Country::namibia(),
1855            520usize => Country::nauru(),
1856            524usize => Country::nepal(),
1857            540usize => Country::new_caledonia(),
1858            554usize => Country::new_zealand(),
1859            558usize => Country::nicaragua(),
1860            566usize => Country::nigeria(),
1861            570usize => Country::niue(),
1862            574usize => Country::norfolk_island(),
1863            578usize => Country::norway(),
1864            512usize => Country::oman(),
1865            586usize => Country::pakistan(),
1866            585usize => Country::palau(),
1867            591usize => Country::panama(),
1868            598usize => Country::papua_new_guinea(),
1869            600usize => Country::paraguay(),
1870            604usize => Country::peru(),
1871            612usize => Country::pitcairn(),
1872            616usize => Country::poland(),
1873            620usize => Country::portugal(),
1874            630usize => Country::puerto_rico(),
1875            634usize => Country::qatar(),
1876            807usize => Country::republic_of_north_macedonia(),
1877            638usize => Country::reunion(),
1878            642usize => Country::romania(),
1879            646usize => Country::rwanda(),
1880            652usize => Country::saint_barthelemy(),
1881            659usize => Country::saint_kitts_and_nevis(),
1882            662usize => Country::saint_lucia(),
1883            666usize => Country::saint_pierre_and_miquelon(),
1884            670usize => Country::saint_vincent_and_the_grenadines(),
1885            882usize => Country::samoa(),
1886            674usize => Country::san_marino(),
1887            678usize => Country::sao_tome_and_principe(),
1888            682usize => Country::saudi_arabia(),
1889            686usize => Country::senegal(),
1890            688usize => Country::serbia(),
1891            690usize => Country::seychelles(),
1892            694usize => Country::sierra_leone(),
1893            702usize => Country::singapore(),
1894            703usize => Country::slovakia(),
1895            705usize => Country::slovenia(),
1896            90usize => Country::solomon_islands(),
1897            706usize => Country::somalia(),
1898            710usize => Country::south_africa(),
1899            239usize => Country::south_georgia_and_the_south_sandwich_islands(),
1900            728usize => Country::south_sudan(),
1901            724usize => Country::spain(),
1902            144usize => Country::sri_lanka(),
1903            275usize => Country::state_of_palestine(),
1904            740usize => Country::suriname(),
1905            744usize => Country::svalbard_and_jan_mayen(),
1906            752usize => Country::sweden(),
1907            756usize => Country::switzerland(),
1908            760usize => Country::syrian_arab_republic(),
1909            158usize => Country::taiwan(),
1910            762usize => Country::tajikistan(),
1911            764usize => Country::thailand(),
1912            44usize => Country::the_bahamas(),
1913            136usize => Country::the_cayman_islands(),
1914            140usize => Country::the_central_african_republic(),
1915            166usize => Country::the_cocos_keeling_islands(),
1916            174usize => Country::the_comoros(),
1917            178usize => Country::the_congo(),
1918            184usize => Country::the_cook_islands(),
1919            408usize => Country::the_democratic_peoples_republic_of_korea(),
1920            180usize => Country::the_democratic_republic_of_the_congo(),
1921            214usize => Country::the_dominican_republic(),
1922            238usize => Country::the_falkland_islands_malvinas(),
1923            234usize => Country::the_faroe_islands(),
1924            260usize => Country::the_french_southern_territories(),
1925            270usize => Country::the_gambia(),
1926            336usize => Country::the_holy_see(),
1927            418usize => Country::the_lao_peoples_democratic_republic(),
1928            584usize => Country::the_marshall_islands(),
1929            528usize => Country::the_netherlands(),
1930            562usize => Country::the_niger(),
1931            580usize => Country::the_northern_mariana_islands(),
1932            608usize => Country::the_philippines(),
1933            410usize => Country::the_republic_of_korea(),
1934            498usize => Country::the_republic_of_moldova(),
1935            643usize => Country::the_russian_federation(),
1936            729usize => Country::the_sudan(),
1937            796usize => Country::the_turks_and_caicos_islands(),
1938            784usize => Country::the_united_arab_emirates(),
1939            826usize => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
1940            581usize => Country::the_united_states_minor_outlying_islands(),
1941            840usize => Country::the_united_states_of_america(),
1942            626usize => Country::timor_leste(),
1943            768usize => Country::togo(),
1944            772usize => Country::tokelau(),
1945            776usize => Country::tonga(),
1946            780usize => Country::trinidad_and_tobago(),
1947            788usize => Country::tunisia(),
1948            792usize => Country::turkey(),
1949            795usize => Country::turkmenistan(),
1950            798usize => Country::tuvalu(),
1951            850usize => Country::us_virgin_islands(),
1952            800usize => Country::uganda(),
1953            804usize => Country::ukraine(),
1954            834usize => Country::united_republic_of_tanzania(),
1955            858usize => Country::uruguay(),
1956            860usize => Country::uzbekistan(),
1957            548usize => Country::vanuatu(),
1958            704usize => Country::vietnam(),
1959            876usize => Country::wallis_and_futuna(),
1960            732usize => Country::western_sahara(),
1961            887usize => Country::yemen(),
1962            894usize => Country::zambia(),
1963            716usize => Country::zimbabwe(),
1964        };
1965        VALUES.get(&value).copied().ok_or("invalid value")
1966    }
1967
1968    /// Given the three digit code, return a country or an error if
1969    /// the parameter doesn't match any country. The value MUST be
1970    /// the three digit code which includes leading zeros.
1971    ///
1972    /// # Errors
1973    ///
1974    /// Returns an error if the code does not match any known country.
1975    ///
1976    /// ```
1977    /// use celes::Country;
1978    ///
1979    /// let res = Country::from_code("8");
1980    /// assert!(res.is_err());
1981    ///
1982    /// let res = Country::from_code("08");
1983    /// assert!(res.is_err());
1984    ///
1985    /// let res = Country::from_code("008");
1986    /// assert!(res.is_ok());
1987    ///
1988    /// assert_eq!(Country::albania(), res.unwrap());
1989    /// ```
1990    #[allow(clippy::too_many_lines)]
1991    pub fn from_code<A: AsRef<str>>(code: A) -> Result<Self, &'static str> {
1992        static CODES: Map<&'static str, Country> = phf_map! {
1993            "004" => Country::afghanistan(),
1994            "248" => Country::aland_islands(),
1995            "008" => Country::albania(),
1996            "012" => Country::algeria(),
1997            "016" => Country::american_samoa(),
1998            "020" => Country::andorra(),
1999            "024" => Country::angola(),
2000            "660" => Country::anguilla(),
2001            "010" => Country::antarctica(),
2002            "028" => Country::antigua_and_barbuda(),
2003            "032" => Country::argentina(),
2004            "051" => Country::armenia(),
2005            "533" => Country::aruba(),
2006            "654" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2007            "036" => Country::australia(),
2008            "040" => Country::austria(),
2009            "031" => Country::azerbaijan(),
2010            "048" => Country::bahrain(),
2011            "050" => Country::bangladesh(),
2012            "052" => Country::barbados(),
2013            "112" => Country::belarus(),
2014            "056" => Country::belgium(),
2015            "084" => Country::belize(),
2016            "204" => Country::benin(),
2017            "060" => Country::bermuda(),
2018            "064" => Country::bhutan(),
2019            "862" => Country::bolivarian_republic_of_venezuela(),
2020            "068" => Country::bolivia(),
2021            "535" => Country::bonaire(),
2022            "070" => Country::bosnia_and_herzegovina(),
2023            "072" => Country::botswana(),
2024            "074" => Country::bouvet_island(),
2025            "076" => Country::brazil(),
2026            "086" => Country::british_indian_ocean_territory(),
2027            "092" => Country::british_virgin_islands(),
2028            "096" => Country::brunei_darussalam(),
2029            "100" => Country::bulgaria(),
2030            "854" => Country::burkina_faso(),
2031            "108" => Country::burundi(),
2032            "132" => Country::cabo_verde(),
2033            "116" => Country::cambodia(),
2034            "120" => Country::cameroon(),
2035            "124" => Country::canada(),
2036            "148" => Country::chad(),
2037            "152" => Country::chile(),
2038            "156" => Country::china(),
2039            "162" => Country::christmas_island(),
2040            "170" => Country::colombia(),
2041            "188" => Country::costa_rica(),
2042            "384" => Country::coted_ivoire(),
2043            "191" => Country::croatia(),
2044            "192" => Country::cuba(),
2045            "531" => Country::curacao(),
2046            "196" => Country::cyprus(),
2047            "203" => Country::czechia(),
2048            "208" => Country::denmark(),
2049            "262" => Country::djibouti(),
2050            "212" => Country::dominica(),
2051            "534" => Country::dutch_part_sint_maarten(),
2052            "218" => Country::ecuador(),
2053            "818" => Country::egypt(),
2054            "222" => Country::el_salvador(),
2055            "226" => Country::equatorial_guinea(),
2056            "232" => Country::eritrea(),
2057            "233" => Country::estonia(),
2058            "748" => Country::eswatini(),
2059            "231" => Country::ethiopia(),
2060            "583" => Country::federated_states_of_micronesia(),
2061            "242" => Country::fiji(),
2062            "246" => Country::finland(),
2063            "250" => Country::france(),
2064            "254" => Country::french_guiana(),
2065            "663" => Country::french_part_saint_martin(),
2066            "258" => Country::french_polynesia(),
2067            "266" => Country::gabon(),
2068            "268" => Country::georgia(),
2069            "276" => Country::germany(),
2070            "288" => Country::ghana(),
2071            "292" => Country::gibraltar(),
2072            "300" => Country::greece(),
2073            "304" => Country::greenland(),
2074            "308" => Country::grenada(),
2075            "312" => Country::guadeloupe(),
2076            "316" => Country::guam(),
2077            "320" => Country::guatemala(),
2078            "831" => Country::guernsey(),
2079            "324" => Country::guinea(),
2080            "624" => Country::guinea_bissau(),
2081            "328" => Country::guyana(),
2082            "332" => Country::haiti(),
2083            "334" => Country::heard_island_and_mc_donald_islands(),
2084            "340" => Country::honduras(),
2085            "344" => Country::hong_kong(),
2086            "348" => Country::hungary(),
2087            "352" => Country::iceland(),
2088            "356" => Country::india(),
2089            "360" => Country::indonesia(),
2090            "368" => Country::iraq(),
2091            "372" => Country::ireland(),
2092            "364" => Country::islamic_republic_of_iran(),
2093            "833" => Country::isle_of_man(),
2094            "376" => Country::israel(),
2095            "380" => Country::italy(),
2096            "388" => Country::jamaica(),
2097            "392" => Country::japan(),
2098            "832" => Country::jersey(),
2099            "400" => Country::jordan(),
2100            "398" => Country::kazakhstan(),
2101            "404" => Country::kenya(),
2102            "296" => Country::kiribati(),
2103            "383" => Country::kosovo(),
2104            "414" => Country::kuwait(),
2105            "417" => Country::kyrgyzstan(),
2106            "428" => Country::latvia(),
2107            "422" => Country::lebanon(),
2108            "426" => Country::lesotho(),
2109            "430" => Country::liberia(),
2110            "434" => Country::libya(),
2111            "438" => Country::liechtenstein(),
2112            "440" => Country::lithuania(),
2113            "442" => Country::luxembourg(),
2114            "446" => Country::macao(),
2115            "450" => Country::madagascar(),
2116            "454" => Country::malawi(),
2117            "458" => Country::malaysia(),
2118            "462" => Country::maldives(),
2119            "466" => Country::mali(),
2120            "470" => Country::malta(),
2121            "474" => Country::martinique(),
2122            "478" => Country::mauritania(),
2123            "480" => Country::mauritius(),
2124            "175" => Country::mayotte(),
2125            "484" => Country::mexico(),
2126            "492" => Country::monaco(),
2127            "496" => Country::mongolia(),
2128            "499" => Country::montenegro(),
2129            "500" => Country::montserrat(),
2130            "504" => Country::morocco(),
2131            "508" => Country::mozambique(),
2132            "104" => Country::myanmar(),
2133            "516" => Country::namibia(),
2134            "520" => Country::nauru(),
2135            "524" => Country::nepal(),
2136            "540" => Country::new_caledonia(),
2137            "554" => Country::new_zealand(),
2138            "558" => Country::nicaragua(),
2139            "566" => Country::nigeria(),
2140            "570" => Country::niue(),
2141            "574" => Country::norfolk_island(),
2142            "578" => Country::norway(),
2143            "512" => Country::oman(),
2144            "586" => Country::pakistan(),
2145            "585" => Country::palau(),
2146            "591" => Country::panama(),
2147            "598" => Country::papua_new_guinea(),
2148            "600" => Country::paraguay(),
2149            "604" => Country::peru(),
2150            "612" => Country::pitcairn(),
2151            "616" => Country::poland(),
2152            "620" => Country::portugal(),
2153            "630" => Country::puerto_rico(),
2154            "634" => Country::qatar(),
2155            "807" => Country::republic_of_north_macedonia(),
2156            "638" => Country::reunion(),
2157            "642" => Country::romania(),
2158            "646" => Country::rwanda(),
2159            "652" => Country::saint_barthelemy(),
2160            "659" => Country::saint_kitts_and_nevis(),
2161            "662" => Country::saint_lucia(),
2162            "666" => Country::saint_pierre_and_miquelon(),
2163            "670" => Country::saint_vincent_and_the_grenadines(),
2164            "882" => Country::samoa(),
2165            "674" => Country::san_marino(),
2166            "678" => Country::sao_tome_and_principe(),
2167            "682" => Country::saudi_arabia(),
2168            "686" => Country::senegal(),
2169            "688" => Country::serbia(),
2170            "690" => Country::seychelles(),
2171            "694" => Country::sierra_leone(),
2172            "702" => Country::singapore(),
2173            "703" => Country::slovakia(),
2174            "705" => Country::slovenia(),
2175            "090" => Country::solomon_islands(),
2176            "706" => Country::somalia(),
2177            "710" => Country::south_africa(),
2178            "239" => Country::south_georgia_and_the_south_sandwich_islands(),
2179            "728" => Country::south_sudan(),
2180            "724" => Country::spain(),
2181            "144" => Country::sri_lanka(),
2182            "275" => Country::state_of_palestine(),
2183            "740" => Country::suriname(),
2184            "744" => Country::svalbard_and_jan_mayen(),
2185            "752" => Country::sweden(),
2186            "756" => Country::switzerland(),
2187            "760" => Country::syrian_arab_republic(),
2188            "158" => Country::taiwan(),
2189            "762" => Country::tajikistan(),
2190            "764" => Country::thailand(),
2191            "044" => Country::the_bahamas(),
2192            "136" => Country::the_cayman_islands(),
2193            "140" => Country::the_central_african_republic(),
2194            "166" => Country::the_cocos_keeling_islands(),
2195            "174" => Country::the_comoros(),
2196            "178" => Country::the_congo(),
2197            "184" => Country::the_cook_islands(),
2198            "408" => Country::the_democratic_peoples_republic_of_korea(),
2199            "180" => Country::the_democratic_republic_of_the_congo(),
2200            "214" => Country::the_dominican_republic(),
2201            "238" => Country::the_falkland_islands_malvinas(),
2202            "234" => Country::the_faroe_islands(),
2203            "260" => Country::the_french_southern_territories(),
2204            "270" => Country::the_gambia(),
2205            "336" => Country::the_holy_see(),
2206            "418" => Country::the_lao_peoples_democratic_republic(),
2207            "584" => Country::the_marshall_islands(),
2208            "528" => Country::the_netherlands(),
2209            "562" => Country::the_niger(),
2210            "580" => Country::the_northern_mariana_islands(),
2211            "608" => Country::the_philippines(),
2212            "410" => Country::the_republic_of_korea(),
2213            "498" => Country::the_republic_of_moldova(),
2214            "643" => Country::the_russian_federation(),
2215            "729" => Country::the_sudan(),
2216            "796" => Country::the_turks_and_caicos_islands(),
2217            "784" => Country::the_united_arab_emirates(),
2218            "826" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2219            "581" => Country::the_united_states_minor_outlying_islands(),
2220            "840" => Country::the_united_states_of_america(),
2221            "626" => Country::timor_leste(),
2222            "768" => Country::togo(),
2223            "772" => Country::tokelau(),
2224            "776" => Country::tonga(),
2225            "780" => Country::trinidad_and_tobago(),
2226            "788" => Country::tunisia(),
2227            "792" => Country::turkey(),
2228            "795" => Country::turkmenistan(),
2229            "798" => Country::tuvalu(),
2230            "850" => Country::us_virgin_islands(),
2231            "800" => Country::uganda(),
2232            "804" => Country::ukraine(),
2233            "834" => Country::united_republic_of_tanzania(),
2234            "858" => Country::uruguay(),
2235            "860" => Country::uzbekistan(),
2236            "548" => Country::vanuatu(),
2237            "704" => Country::vietnam(),
2238            "876" => Country::wallis_and_futuna(),
2239            "732" => Country::western_sahara(),
2240            "887" => Country::yemen(),
2241            "894" => Country::zambia(),
2242            "716" => Country::zimbabwe(),
2243        };
2244        CODES.get(code.as_ref()).copied().ok_or("invalid code")
2245    }
2246
2247    /// Given the alpha2 letters, return a country or an error if
2248    /// the parameter doesn't match any country. This is case-insensitive.
2249    ///
2250    /// # Errors
2251    ///
2252    /// Returns an error if the alpha2 code does not match any known country.
2253    ///
2254    /// ```
2255    /// use celes::Country;
2256    ///
2257    /// let res = Country::from_alpha2("u");
2258    /// assert!(res.is_err());
2259    ///
2260    /// let res = Country::from_alpha2("us");
2261    /// assert!(res.is_ok());
2262    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2263    ///
2264    /// let res = Country::from_alpha2("Us");
2265    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2266    ///
2267    /// let res = Country::from_alpha2("uS");
2268    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2269    ///
2270    /// let res = Country::from_alpha2("US");
2271    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2272    /// ```
2273    #[allow(clippy::too_many_lines)]
2274    pub fn from_alpha2<A: AsRef<str>>(alpha2: A) -> Result<Self, &'static str> {
2275        static ALPHA2: Map<&'static str, Country> = phf_map! {
2276            "af" => Country::afghanistan(),
2277            "ax" => Country::aland_islands(),
2278            "al" => Country::albania(),
2279            "dz" => Country::algeria(),
2280            "as" => Country::american_samoa(),
2281            "ad" => Country::andorra(),
2282            "ao" => Country::angola(),
2283            "ai" => Country::anguilla(),
2284            "aq" => Country::antarctica(),
2285            "ag" => Country::antigua_and_barbuda(),
2286            "ar" => Country::argentina(),
2287            "am" => Country::armenia(),
2288            "aw" => Country::aruba(),
2289            "sh" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2290            "au" => Country::australia(),
2291            "at" => Country::austria(),
2292            "az" => Country::azerbaijan(),
2293            "bh" => Country::bahrain(),
2294            "bd" => Country::bangladesh(),
2295            "bb" => Country::barbados(),
2296            "by" => Country::belarus(),
2297            "be" => Country::belgium(),
2298            "bz" => Country::belize(),
2299            "bj" => Country::benin(),
2300            "bm" => Country::bermuda(),
2301            "bt" => Country::bhutan(),
2302            "ve" => Country::bolivarian_republic_of_venezuela(),
2303            "bo" => Country::bolivia(),
2304            "bq" => Country::bonaire(),
2305            "ba" => Country::bosnia_and_herzegovina(),
2306            "bw" => Country::botswana(),
2307            "bv" => Country::bouvet_island(),
2308            "br" => Country::brazil(),
2309            "io" => Country::british_indian_ocean_territory(),
2310            "vg" => Country::british_virgin_islands(),
2311            "bn" => Country::brunei_darussalam(),
2312            "bg" => Country::bulgaria(),
2313            "bf" => Country::burkina_faso(),
2314            "bi" => Country::burundi(),
2315            "cv" => Country::cabo_verde(),
2316            "kh" => Country::cambodia(),
2317            "cm" => Country::cameroon(),
2318            "ca" => Country::canada(),
2319            "td" => Country::chad(),
2320            "cl" => Country::chile(),
2321            "cn" => Country::china(),
2322            "cx" => Country::christmas_island(),
2323            "co" => Country::colombia(),
2324            "cr" => Country::costa_rica(),
2325            "ci" => Country::coted_ivoire(),
2326            "hr" => Country::croatia(),
2327            "cu" => Country::cuba(),
2328            "cw" => Country::curacao(),
2329            "cy" => Country::cyprus(),
2330            "cz" => Country::czechia(),
2331            "dk" => Country::denmark(),
2332            "dj" => Country::djibouti(),
2333            "dm" => Country::dominica(),
2334            "sx" => Country::dutch_part_sint_maarten(),
2335            "ec" => Country::ecuador(),
2336            "eg" => Country::egypt(),
2337            "sv" => Country::el_salvador(),
2338            "gq" => Country::equatorial_guinea(),
2339            "er" => Country::eritrea(),
2340            "ee" => Country::estonia(),
2341            "sz" => Country::eswatini(),
2342            "et" => Country::ethiopia(),
2343            "fm" => Country::federated_states_of_micronesia(),
2344            "fj" => Country::fiji(),
2345            "fi" => Country::finland(),
2346            "fr" => Country::france(),
2347            "gf" => Country::french_guiana(),
2348            "mf" => Country::french_part_saint_martin(),
2349            "pf" => Country::french_polynesia(),
2350            "ga" => Country::gabon(),
2351            "ge" => Country::georgia(),
2352            "de" => Country::germany(),
2353            "gh" => Country::ghana(),
2354            "gi" => Country::gibraltar(),
2355            "gr" => Country::greece(),
2356            "gl" => Country::greenland(),
2357            "gd" => Country::grenada(),
2358            "gp" => Country::guadeloupe(),
2359            "gu" => Country::guam(),
2360            "gt" => Country::guatemala(),
2361            "gg" => Country::guernsey(),
2362            "gn" => Country::guinea(),
2363            "gw" => Country::guinea_bissau(),
2364            "gy" => Country::guyana(),
2365            "ht" => Country::haiti(),
2366            "hm" => Country::heard_island_and_mc_donald_islands(),
2367            "hn" => Country::honduras(),
2368            "hk" => Country::hong_kong(),
2369            "hu" => Country::hungary(),
2370            "is" => Country::iceland(),
2371            "in" => Country::india(),
2372            "id" => Country::indonesia(),
2373            "iq" => Country::iraq(),
2374            "ie" => Country::ireland(),
2375            "ir" => Country::islamic_republic_of_iran(),
2376            "im" => Country::isle_of_man(),
2377            "il" => Country::israel(),
2378            "it" => Country::italy(),
2379            "jm" => Country::jamaica(),
2380            "jp" => Country::japan(),
2381            "je" => Country::jersey(),
2382            "jo" => Country::jordan(),
2383            "kz" => Country::kazakhstan(),
2384            "ke" => Country::kenya(),
2385            "ki" => Country::kiribati(),
2386            "xk" => Country::kosovo(),
2387            "kw" => Country::kuwait(),
2388            "kg" => Country::kyrgyzstan(),
2389            "lv" => Country::latvia(),
2390            "lb" => Country::lebanon(),
2391            "ls" => Country::lesotho(),
2392            "lr" => Country::liberia(),
2393            "ly" => Country::libya(),
2394            "li" => Country::liechtenstein(),
2395            "lt" => Country::lithuania(),
2396            "lu" => Country::luxembourg(),
2397            "mo" => Country::macao(),
2398            "mg" => Country::madagascar(),
2399            "mw" => Country::malawi(),
2400            "my" => Country::malaysia(),
2401            "mv" => Country::maldives(),
2402            "ml" => Country::mali(),
2403            "mt" => Country::malta(),
2404            "mq" => Country::martinique(),
2405            "mr" => Country::mauritania(),
2406            "mu" => Country::mauritius(),
2407            "yt" => Country::mayotte(),
2408            "mx" => Country::mexico(),
2409            "mc" => Country::monaco(),
2410            "mn" => Country::mongolia(),
2411            "me" => Country::montenegro(),
2412            "ms" => Country::montserrat(),
2413            "ma" => Country::morocco(),
2414            "mz" => Country::mozambique(),
2415            "mm" => Country::myanmar(),
2416            "na" => Country::namibia(),
2417            "nr" => Country::nauru(),
2418            "np" => Country::nepal(),
2419            "nc" => Country::new_caledonia(),
2420            "nz" => Country::new_zealand(),
2421            "ni" => Country::nicaragua(),
2422            "ng" => Country::nigeria(),
2423            "nu" => Country::niue(),
2424            "nf" => Country::norfolk_island(),
2425            "no" => Country::norway(),
2426            "om" => Country::oman(),
2427            "pk" => Country::pakistan(),
2428            "pw" => Country::palau(),
2429            "pa" => Country::panama(),
2430            "pg" => Country::papua_new_guinea(),
2431            "py" => Country::paraguay(),
2432            "pe" => Country::peru(),
2433            "pn" => Country::pitcairn(),
2434            "pl" => Country::poland(),
2435            "pt" => Country::portugal(),
2436            "pr" => Country::puerto_rico(),
2437            "qa" => Country::qatar(),
2438            "mk" => Country::republic_of_north_macedonia(),
2439            "re" => Country::reunion(),
2440            "ro" => Country::romania(),
2441            "rw" => Country::rwanda(),
2442            "bl" => Country::saint_barthelemy(),
2443            "kn" => Country::saint_kitts_and_nevis(),
2444            "lc" => Country::saint_lucia(),
2445            "pm" => Country::saint_pierre_and_miquelon(),
2446            "vc" => Country::saint_vincent_and_the_grenadines(),
2447            "ws" => Country::samoa(),
2448            "sm" => Country::san_marino(),
2449            "st" => Country::sao_tome_and_principe(),
2450            "sa" => Country::saudi_arabia(),
2451            "sn" => Country::senegal(),
2452            "rs" => Country::serbia(),
2453            "sc" => Country::seychelles(),
2454            "sl" => Country::sierra_leone(),
2455            "sg" => Country::singapore(),
2456            "sk" => Country::slovakia(),
2457            "si" => Country::slovenia(),
2458            "sb" => Country::solomon_islands(),
2459            "so" => Country::somalia(),
2460            "za" => Country::south_africa(),
2461            "gs" => Country::south_georgia_and_the_south_sandwich_islands(),
2462            "ss" => Country::south_sudan(),
2463            "es" => Country::spain(),
2464            "lk" => Country::sri_lanka(),
2465            "ps" => Country::state_of_palestine(),
2466            "sr" => Country::suriname(),
2467            "sj" => Country::svalbard_and_jan_mayen(),
2468            "se" => Country::sweden(),
2469            "ch" => Country::switzerland(),
2470            "sy" => Country::syrian_arab_republic(),
2471            "tw" => Country::taiwan(),
2472            "tj" => Country::tajikistan(),
2473            "th" => Country::thailand(),
2474            "bs" => Country::the_bahamas(),
2475            "ky" => Country::the_cayman_islands(),
2476            "cf" => Country::the_central_african_republic(),
2477            "cc" => Country::the_cocos_keeling_islands(),
2478            "km" => Country::the_comoros(),
2479            "cg" => Country::the_congo(),
2480            "ck" => Country::the_cook_islands(),
2481            "kp" => Country::the_democratic_peoples_republic_of_korea(),
2482            "cd" => Country::the_democratic_republic_of_the_congo(),
2483            "do" => Country::the_dominican_republic(),
2484            "fk" => Country::the_falkland_islands_malvinas(),
2485            "fo" => Country::the_faroe_islands(),
2486            "tf" => Country::the_french_southern_territories(),
2487            "gm" => Country::the_gambia(),
2488            "va" => Country::the_holy_see(),
2489            "la" => Country::the_lao_peoples_democratic_republic(),
2490            "mh" => Country::the_marshall_islands(),
2491            "nl" => Country::the_netherlands(),
2492            "ne" => Country::the_niger(),
2493            "mp" => Country::the_northern_mariana_islands(),
2494            "ph" => Country::the_philippines(),
2495            "kr" => Country::the_republic_of_korea(),
2496            "md" => Country::the_republic_of_moldova(),
2497            "ru" => Country::the_russian_federation(),
2498            "sd" => Country::the_sudan(),
2499            "tc" => Country::the_turks_and_caicos_islands(),
2500            "ae" => Country::the_united_arab_emirates(),
2501            "gb" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2502            "um" => Country::the_united_states_minor_outlying_islands(),
2503            "us" => Country::the_united_states_of_america(),
2504            "tl" => Country::timor_leste(),
2505            "tg" => Country::togo(),
2506            "tk" => Country::tokelau(),
2507            "to" => Country::tonga(),
2508            "tt" => Country::trinidad_and_tobago(),
2509            "tn" => Country::tunisia(),
2510            "tr" => Country::turkey(),
2511            "tm" => Country::turkmenistan(),
2512            "tv" => Country::tuvalu(),
2513            "vi" => Country::us_virgin_islands(),
2514            "ug" => Country::uganda(),
2515            "ua" => Country::ukraine(),
2516            "tz" => Country::united_republic_of_tanzania(),
2517            "uy" => Country::uruguay(),
2518            "uz" => Country::uzbekistan(),
2519            "vu" => Country::vanuatu(),
2520            "vn" => Country::vietnam(),
2521            "wf" => Country::wallis_and_futuna(),
2522            "eh" => Country::western_sahara(),
2523            "ye" => Country::yemen(),
2524            "zm" => Country::zambia(),
2525            "zw" => Country::zimbabwe(),
2526        };
2527        lookup_ascii_lowercase(&ALPHA2, alpha2.as_ref())
2528            .copied()
2529            .ok_or("invalid alpha2")
2530    }
2531
2532    /// Given the alpha3 letters, return a country or an error if
2533    /// the parameter doesn't match any country. This is case-insensitive.
2534    ///
2535    /// # Errors
2536    ///
2537    /// Returns an error if the alpha3 code does not match any known country.
2538    ///
2539    /// ```
2540    /// use celes::Country;
2541    ///
2542    /// let res = Country::from_alpha3("u");
2543    /// assert!(res.is_err());
2544    ///
2545    /// let res = Country::from_alpha3("us");
2546    /// assert!(res.is_err());
2547    ///
2548    /// let res = Country::from_alpha3("Usa");
2549    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2550    ///
2551    /// let res = Country::from_alpha3("uSa");
2552    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2553    ///
2554    /// let res = Country::from_alpha3("USA");
2555    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2556    /// ```
2557    #[allow(clippy::too_many_lines)]
2558    pub fn from_alpha3<A: AsRef<str>>(alpha3: A) -> Result<Self, &'static str> {
2559        static ALPHA3: Map<&'static str, Country> = phf_map! {
2560            "afg" => Country::afghanistan(),
2561            "ala" => Country::aland_islands(),
2562            "alb" => Country::albania(),
2563            "dza" => Country::algeria(),
2564            "asm" => Country::american_samoa(),
2565            "and" => Country::andorra(),
2566            "ago" => Country::angola(),
2567            "aia" => Country::anguilla(),
2568            "ata" => Country::antarctica(),
2569            "atg" => Country::antigua_and_barbuda(),
2570            "arg" => Country::argentina(),
2571            "arm" => Country::armenia(),
2572            "abw" => Country::aruba(),
2573            "shn" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2574            "aus" => Country::australia(),
2575            "aut" => Country::austria(),
2576            "aze" => Country::azerbaijan(),
2577            "bhr" => Country::bahrain(),
2578            "bgd" => Country::bangladesh(),
2579            "brb" => Country::barbados(),
2580            "blr" => Country::belarus(),
2581            "bel" => Country::belgium(),
2582            "blz" => Country::belize(),
2583            "ben" => Country::benin(),
2584            "bmu" => Country::bermuda(),
2585            "btn" => Country::bhutan(),
2586            "ven" => Country::bolivarian_republic_of_venezuela(),
2587            "bol" => Country::bolivia(),
2588            "bes" => Country::bonaire(),
2589            "bih" => Country::bosnia_and_herzegovina(),
2590            "bwa" => Country::botswana(),
2591            "bvt" => Country::bouvet_island(),
2592            "bra" => Country::brazil(),
2593            "iot" => Country::british_indian_ocean_territory(),
2594            "vgb" => Country::british_virgin_islands(),
2595            "brn" => Country::brunei_darussalam(),
2596            "bgr" => Country::bulgaria(),
2597            "bfa" => Country::burkina_faso(),
2598            "bdi" => Country::burundi(),
2599            "cpv" => Country::cabo_verde(),
2600            "khm" => Country::cambodia(),
2601            "cmr" => Country::cameroon(),
2602            "can" => Country::canada(),
2603            "tcd" => Country::chad(),
2604            "chl" => Country::chile(),
2605            "chn" => Country::china(),
2606            "cxr" => Country::christmas_island(),
2607            "col" => Country::colombia(),
2608            "cri" => Country::costa_rica(),
2609            "civ" => Country::coted_ivoire(),
2610            "hrv" => Country::croatia(),
2611            "cub" => Country::cuba(),
2612            "cuw" => Country::curacao(),
2613            "cyp" => Country::cyprus(),
2614            "cze" => Country::czechia(),
2615            "dnk" => Country::denmark(),
2616            "dji" => Country::djibouti(),
2617            "dma" => Country::dominica(),
2618            "sxm" => Country::dutch_part_sint_maarten(),
2619            "ecu" => Country::ecuador(),
2620            "egy" => Country::egypt(),
2621            "slv" => Country::el_salvador(),
2622            "gnq" => Country::equatorial_guinea(),
2623            "eri" => Country::eritrea(),
2624            "est" => Country::estonia(),
2625            "swz" => Country::eswatini(),
2626            "eth" => Country::ethiopia(),
2627            "fsm" => Country::federated_states_of_micronesia(),
2628            "fji" => Country::fiji(),
2629            "fin" => Country::finland(),
2630            "fra" => Country::france(),
2631            "guf" => Country::french_guiana(),
2632            "maf" => Country::french_part_saint_martin(),
2633            "pyf" => Country::french_polynesia(),
2634            "gab" => Country::gabon(),
2635            "geo" => Country::georgia(),
2636            "deu" => Country::germany(),
2637            "gha" => Country::ghana(),
2638            "gib" => Country::gibraltar(),
2639            "grc" => Country::greece(),
2640            "grl" => Country::greenland(),
2641            "grd" => Country::grenada(),
2642            "glp" => Country::guadeloupe(),
2643            "gum" => Country::guam(),
2644            "gtm" => Country::guatemala(),
2645            "ggy" => Country::guernsey(),
2646            "gin" => Country::guinea(),
2647            "gnb" => Country::guinea_bissau(),
2648            "guy" => Country::guyana(),
2649            "hti" => Country::haiti(),
2650            "hmd" => Country::heard_island_and_mc_donald_islands(),
2651            "hnd" => Country::honduras(),
2652            "hkg" => Country::hong_kong(),
2653            "hun" => Country::hungary(),
2654            "isl" => Country::iceland(),
2655            "ind" => Country::india(),
2656            "idn" => Country::indonesia(),
2657            "irq" => Country::iraq(),
2658            "irl" => Country::ireland(),
2659            "irn" => Country::islamic_republic_of_iran(),
2660            "imn" => Country::isle_of_man(),
2661            "isr" => Country::israel(),
2662            "ita" => Country::italy(),
2663            "jam" => Country::jamaica(),
2664            "jpn" => Country::japan(),
2665            "jey" => Country::jersey(),
2666            "jor" => Country::jordan(),
2667            "kaz" => Country::kazakhstan(),
2668            "ken" => Country::kenya(),
2669            "xkx" => Country::kosovo(),
2670            "kir" => Country::kiribati(),
2671            "kwt" => Country::kuwait(),
2672            "kgz" => Country::kyrgyzstan(),
2673            "lva" => Country::latvia(),
2674            "lbn" => Country::lebanon(),
2675            "lso" => Country::lesotho(),
2676            "lbr" => Country::liberia(),
2677            "lby" => Country::libya(),
2678            "lie" => Country::liechtenstein(),
2679            "ltu" => Country::lithuania(),
2680            "lux" => Country::luxembourg(),
2681            "mac" => Country::macao(),
2682            "mdg" => Country::madagascar(),
2683            "mwi" => Country::malawi(),
2684            "mys" => Country::malaysia(),
2685            "mdv" => Country::maldives(),
2686            "mli" => Country::mali(),
2687            "mlt" => Country::malta(),
2688            "mtq" => Country::martinique(),
2689            "mrt" => Country::mauritania(),
2690            "mus" => Country::mauritius(),
2691            "myt" => Country::mayotte(),
2692            "mex" => Country::mexico(),
2693            "mco" => Country::monaco(),
2694            "mng" => Country::mongolia(),
2695            "mne" => Country::montenegro(),
2696            "msr" => Country::montserrat(),
2697            "mar" => Country::morocco(),
2698            "moz" => Country::mozambique(),
2699            "mmr" => Country::myanmar(),
2700            "nam" => Country::namibia(),
2701            "nru" => Country::nauru(),
2702            "npl" => Country::nepal(),
2703            "ncl" => Country::new_caledonia(),
2704            "nzl" => Country::new_zealand(),
2705            "nic" => Country::nicaragua(),
2706            "nga" => Country::nigeria(),
2707            "niu" => Country::niue(),
2708            "nfk" => Country::norfolk_island(),
2709            "nor" => Country::norway(),
2710            "omn" => Country::oman(),
2711            "pak" => Country::pakistan(),
2712            "plw" => Country::palau(),
2713            "pan" => Country::panama(),
2714            "png" => Country::papua_new_guinea(),
2715            "pry" => Country::paraguay(),
2716            "per" => Country::peru(),
2717            "pcn" => Country::pitcairn(),
2718            "pol" => Country::poland(),
2719            "prt" => Country::portugal(),
2720            "pri" => Country::puerto_rico(),
2721            "qat" => Country::qatar(),
2722            "mkd" => Country::republic_of_north_macedonia(),
2723            "reu" => Country::reunion(),
2724            "rou" => Country::romania(),
2725            "rwa" => Country::rwanda(),
2726            "blm" => Country::saint_barthelemy(),
2727            "kna" => Country::saint_kitts_and_nevis(),
2728            "lca" => Country::saint_lucia(),
2729            "spm" => Country::saint_pierre_and_miquelon(),
2730            "vct" => Country::saint_vincent_and_the_grenadines(),
2731            "wsm" => Country::samoa(),
2732            "smr" => Country::san_marino(),
2733            "stp" => Country::sao_tome_and_principe(),
2734            "sau" => Country::saudi_arabia(),
2735            "sen" => Country::senegal(),
2736            "srb" => Country::serbia(),
2737            "syc" => Country::seychelles(),
2738            "sle" => Country::sierra_leone(),
2739            "sgp" => Country::singapore(),
2740            "svk" => Country::slovakia(),
2741            "svn" => Country::slovenia(),
2742            "slb" => Country::solomon_islands(),
2743            "som" => Country::somalia(),
2744            "zaf" => Country::south_africa(),
2745            "sgs" => Country::south_georgia_and_the_south_sandwich_islands(),
2746            "ssd" => Country::south_sudan(),
2747            "esp" => Country::spain(),
2748            "lka" => Country::sri_lanka(),
2749            "pse" => Country::state_of_palestine(),
2750            "sur" => Country::suriname(),
2751            "sjm" => Country::svalbard_and_jan_mayen(),
2752            "swe" => Country::sweden(),
2753            "che" => Country::switzerland(),
2754            "syr" => Country::syrian_arab_republic(),
2755            "twn" => Country::taiwan(),
2756            "tjk" => Country::tajikistan(),
2757            "tha" => Country::thailand(),
2758            "bhs" => Country::the_bahamas(),
2759            "cym" => Country::the_cayman_islands(),
2760            "caf" => Country::the_central_african_republic(),
2761            "cck" => Country::the_cocos_keeling_islands(),
2762            "com" => Country::the_comoros(),
2763            "cog" => Country::the_congo(),
2764            "cok" => Country::the_cook_islands(),
2765            "prk" => Country::the_democratic_peoples_republic_of_korea(),
2766            "cod" => Country::the_democratic_republic_of_the_congo(),
2767            "dom" => Country::the_dominican_republic(),
2768            "flk" => Country::the_falkland_islands_malvinas(),
2769            "fro" => Country::the_faroe_islands(),
2770            "atf" => Country::the_french_southern_territories(),
2771            "gmb" => Country::the_gambia(),
2772            "vat" => Country::the_holy_see(),
2773            "lao" => Country::the_lao_peoples_democratic_republic(),
2774            "mhl" => Country::the_marshall_islands(),
2775            "nld" => Country::the_netherlands(),
2776            "ner" => Country::the_niger(),
2777            "mnp" => Country::the_northern_mariana_islands(),
2778            "phl" => Country::the_philippines(),
2779            "kor" => Country::the_republic_of_korea(),
2780            "mda" => Country::the_republic_of_moldova(),
2781            "rus" => Country::the_russian_federation(),
2782            "sdn" => Country::the_sudan(),
2783            "tca" => Country::the_turks_and_caicos_islands(),
2784            "are" => Country::the_united_arab_emirates(),
2785            "gbr" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2786            "umi" => Country::the_united_states_minor_outlying_islands(),
2787            "usa" => Country::the_united_states_of_america(),
2788            "tls" => Country::timor_leste(),
2789            "tgo" => Country::togo(),
2790            "tkl" => Country::tokelau(),
2791            "ton" => Country::tonga(),
2792            "tto" => Country::trinidad_and_tobago(),
2793            "tun" => Country::tunisia(),
2794            "tur" => Country::turkey(),
2795            "tkm" => Country::turkmenistan(),
2796            "tuv" => Country::tuvalu(),
2797            "vir" => Country::us_virgin_islands(),
2798            "uga" => Country::uganda(),
2799            "ukr" => Country::ukraine(),
2800            "tza" => Country::united_republic_of_tanzania(),
2801            "ury" => Country::uruguay(),
2802            "uzb" => Country::uzbekistan(),
2803            "vut" => Country::vanuatu(),
2804            "vnm" => Country::vietnam(),
2805            "wlf" => Country::wallis_and_futuna(),
2806            "esh" => Country::western_sahara(),
2807            "yem" => Country::yemen(),
2808            "zmb" => Country::zambia(),
2809            "zwe" => Country::zimbabwe(),
2810        };
2811        lookup_ascii_lowercase(&ALPHA3, alpha3.as_ref())
2812            .copied()
2813            .ok_or("invalid alpha3")
2814    }
2815
2816    /// Given a country alias, return a country or an error if
2817    /// the parameter doesn't match any country
2818    ///
2819    /// The alias is any value in the `aliases` field for a country.
2820    /// For example, "america" would return `the_united_states_of_america`
2821    /// This is case-insensitive.
2822    ///
2823    /// # Errors
2824    ///
2825    /// Returns an error if the alias does not match any known country.
2826    ///
2827    /// ```
2828    /// use celes::Country;
2829    ///
2830    /// let res = Country::from_alias("u");
2831    /// assert!(res.is_err());
2832    ///
2833    /// let res = Country::from_alias("us");
2834    /// assert!(res.is_err());
2835    ///
2836    /// let res = Country::from_alias("america");
2837    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2838    ///
2839    /// let res = Country::from_alias("russia");
2840    /// assert_eq!(Country::the_russian_federation(), res.unwrap());
2841    ///
2842    /// let res = Country::from_alias("england");
2843    /// assert_eq!(Country::the_united_kingdom_of_great_britain_and_northern_ireland(), res.unwrap());
2844    /// ```
2845    #[allow(clippy::too_many_lines)]
2846    pub fn from_alias<A: AsRef<str>>(alias: A) -> Result<Self, &'static str> {
2847        static ALIASES: Map<&'static str, Country> = phf_map! {
2848            "samoa" => Country::american_samoa(),
2849            "sthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2850            "sainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2851            "venezuela" => Country::bolivarian_republic_of_venezuela(),
2852            "bosnia" => Country::bosnia_and_herzegovina(),
2853            "herzegovina" => Country::bosnia_and_herzegovina(),
2854            "brunei" => Country::brunei_darussalam(),
2855            "burkina" => Country::burkina_faso(),
2856            "stmaarten" => Country::dutch_part_sint_maarten(),
2857            "saintmaarten" => Country::dutch_part_sint_maarten(),
2858            "micronesia" => Country::federated_states_of_micronesia(),
2859            "stmartin" => Country::french_part_saint_martin(),
2860            "saintmartin" => Country::french_part_saint_martin(),
2861            "heardisland" => Country::heard_island_and_mc_donald_islands(),
2862            "mcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
2863            "iran" => Country::islamic_republic_of_iran(),
2864            "macedonia" => Country::republic_of_north_macedonia(),
2865            "stbarthelemy" => Country::saint_barthelemy(),
2866            "stkitts" => Country::saint_kitts_and_nevis(),
2867            "stlucia" => Country::saint_lucia(),
2868            "stpierre" => Country::saint_pierre_and_miquelon(),
2869            "saintpierre" => Country::saint_pierre_and_miquelon(),
2870            "stvincent" => Country::saint_vincent_and_the_grenadines(),
2871            "saintvincent" => Country::saint_vincent_and_the_grenadines(),
2872            "saotome" => Country::sao_tome_and_principe(),
2873            "southgeorgia" => Country::south_georgia_and_the_south_sandwich_islands(),
2874            "southsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
2875            "palestine" => Country::state_of_palestine(),
2876            "taiwan" => Country::taiwan(),
2877            "bahamas" => Country::the_bahamas(),
2878            "caymanislands" => Country::the_cayman_islands(),
2879            "centralafricanrepublic" => Country::the_central_african_republic(),
2880            "cocosislands" => Country::the_cocos_keeling_islands(),
2881            "keelingislands" => Country::the_cocos_keeling_islands(),
2882            "comoros" => Country::the_comoros(),
2883            "congo" => Country::the_congo(),
2884            "cookislands" => Country::the_cook_islands(),
2885            "czechrepublic" => Country::czechia(),
2886            "northkorea" => Country::the_democratic_peoples_republic_of_korea(),
2887            "democraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
2888            "democraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
2889            "dominicanrepublic" => Country::the_dominican_republic(),
2890            "easttimor" => Country::timor_leste(),
2891            "malvinas" => Country::the_falkland_islands_malvinas(),
2892            "falklandislands" => Country::the_falkland_islands_malvinas(),
2893            "faroeislands" => Country::the_faroe_islands(),
2894            "frenchsouthernterritories" => Country::the_french_southern_territories(),
2895            "gambia" => Country::the_gambia(),
2896            "holysee" => Country::the_holy_see(),
2897            "laopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
2898            "marshallislands" => Country::the_marshall_islands(),
2899            "netherlands" => Country::the_netherlands(),
2900            "holland" => Country::the_netherlands(),
2901            "niger" => Country::the_niger(),
2902            "northernmarianaislands" => Country::the_northern_mariana_islands(),
2903            "philippines" => Country::the_philippines(),
2904            "southkorea" => Country::the_republic_of_korea(),
2905            "republicofkorea" => Country::the_republic_of_korea(),
2906            "moldova" => Country::the_republic_of_moldova(),
2907            "republicofmoldova" => Country::the_republic_of_moldova(),
2908            "russia" => Country::the_russian_federation(),
2909            "russianfederation" => Country::the_russian_federation(),
2910            "sudan" => Country::the_sudan(),
2911            "turksandcaicosislands" => Country::the_turks_and_caicos_islands(),
2912            "unitedarabemirates" => Country::the_united_arab_emirates(),
2913            "england" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2914            "scotland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2915            "greatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2916            "unitedkingdom" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2917            "northernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2918            "unitedkingdomofgreatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2919            "unitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2920            "unitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
2921            "america" => Country::the_united_states_of_america(),
2922            "unitedstates" => Country::the_united_states_of_america(),
2923            "unitedstatesofamerica" => Country::the_united_states_of_america(),
2924            "trinidad" => Country::trinidad_and_tobago(),
2925            "tobago" => Country::trinidad_and_tobago(),
2926            "tanzania" => Country::united_republic_of_tanzania(),
2927            "türkiye" => Country::turkey(),
2928            "turkiye" => Country::turkey(),
2929            "turkey" => Country::turkey(),
2930            "myanmar" => Country::myanmar(),
2931            "burma" => Country::myanmar(),
2932            "eswatini" => Country::eswatini(),
2933            "swaziland" => Country::eswatini(),
2934            "caboverde" => Country::cabo_verde(),
2935            "capeverde" => Country::cabo_verde(),
2936            "ivorycoast" => Country::coted_ivoire(),
2937            "cotedivoire" => Country::coted_ivoire(),
2938            "northmacedonia" => Country::republic_of_north_macedonia(),
2939            "syria" => Country::syrian_arab_republic(),
2940            "laos" => Country::the_lao_peoples_democratic_republic(),
2941            "macau" => Country::macao(),
2942            "vatican" => Country::the_holy_see(),
2943            "vaticancity" => Country::the_holy_see(),
2944        };
2945        lookup_ascii_lowercase(&ALIASES, alias.as_ref())
2946            .copied()
2947            .ok_or("invalid alias")
2948    }
2949
2950    /// Given the country name, return a country or an error if
2951    /// the parameter doesn't match any country.  This is case-insensitive.
2952    ///
2953    /// For example, Albania, Algeria, Brazil would return the country
2954    /// struct that represents those countries.
2955    ///
2956    /// # Errors
2957    ///
2958    /// Returns an error if the name does not match any known country.
2959    ///
2960    /// ```
2961    /// use celes::Country;
2962    ///
2963    /// let res = Country::from_name("russianfederation");
2964    /// assert!(res.is_err());
2965    ///
2966    /// let res = Country::from_name("unitedstatesofamerica");
2967    /// assert!(res.is_err());
2968    ///
2969    /// let res = Country::from_name("Albania");
2970    /// assert_eq!(Country::albania(), res.unwrap());
2971    ///
2972    /// let res = Country::from_name("theunitedstatesofamerica");
2973    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2974    ///
2975    /// let res = Country::from_name("therussianfederation");
2976    /// assert_eq!(Country::the_russian_federation(), res.unwrap());
2977    ///
2978    /// let res = Country::from_name("theunitedkingdomofgreatbritainandnorthernireland");
2979    /// assert_eq!(Country::the_united_kingdom_of_great_britain_and_northern_ireland(), res.unwrap());
2980    /// ```
2981    #[allow(clippy::too_many_lines)]
2982    pub fn from_name<A: AsRef<str>>(name: A) -> Result<Self, &'static str> {
2983        static NAMES: Map<&'static str, Country> = phf_map! {
2984            "afghanistan" => Country::afghanistan(),
2985            "alandislands" => Country::aland_islands(),
2986            "albania" => Country::albania(),
2987            "algeria" => Country::algeria(),
2988            "americansamoa" => Country::american_samoa(),
2989            "andorra" => Country::andorra(),
2990            "angola" => Country::angola(),
2991            "anguilla" => Country::anguilla(),
2992            "antarctica" => Country::antarctica(),
2993            "antiguaandbarbuda" => Country::antigua_and_barbuda(),
2994            "argentina" => Country::argentina(),
2995            "armenia" => Country::armenia(),
2996            "aruba" => Country::aruba(),
2997            "ascensionandtristandacunhasainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2998            "australia" => Country::australia(),
2999            "austria" => Country::austria(),
3000            "azerbaijan" => Country::azerbaijan(),
3001            "bahrain" => Country::bahrain(),
3002            "bangladesh" => Country::bangladesh(),
3003            "barbados" => Country::barbados(),
3004            "belarus" => Country::belarus(),
3005            "belgium" => Country::belgium(),
3006            "belize" => Country::belize(),
3007            "benin" => Country::benin(),
3008            "bermuda" => Country::bermuda(),
3009            "bhutan" => Country::bhutan(),
3010            "bolivarianrepublicofvenezuela" => Country::bolivarian_republic_of_venezuela(),
3011            "bolivia" => Country::bolivia(),
3012            "bonaire" => Country::bonaire(),
3013            "bosniaandherzegovina" => Country::bosnia_and_herzegovina(),
3014            "botswana" => Country::botswana(),
3015            "bouvetisland" => Country::bouvet_island(),
3016            "brazil" => Country::brazil(),
3017            "britishindianoceanterritory" => Country::british_indian_ocean_territory(),
3018            "britishvirginislands" => Country::british_virgin_islands(),
3019            "bruneidarussalam" => Country::brunei_darussalam(),
3020            "bulgaria" => Country::bulgaria(),
3021            "burkinafaso" => Country::burkina_faso(),
3022            "burundi" => Country::burundi(),
3023            "caboverde" => Country::cabo_verde(),
3024            "cambodia" => Country::cambodia(),
3025            "cameroon" => Country::cameroon(),
3026            "canada" => Country::canada(),
3027            "chad" => Country::chad(),
3028            "chile" => Country::chile(),
3029            "china" => Country::china(),
3030            "christmasisland" => Country::christmas_island(),
3031            "colombia" => Country::colombia(),
3032            "costarica" => Country::costa_rica(),
3033            "cotedivoire" => Country::coted_ivoire(),
3034            "croatia" => Country::croatia(),
3035            "cuba" => Country::cuba(),
3036            "curacao" => Country::curacao(),
3037            "cyprus" => Country::cyprus(),
3038            "czechia" => Country::czechia(),
3039            "denmark" => Country::denmark(),
3040            "djibouti" => Country::djibouti(),
3041            "dominica" => Country::dominica(),
3042            "dutchpartsintmaarten" => Country::dutch_part_sint_maarten(),
3043            "ecuador" => Country::ecuador(),
3044            "egypt" => Country::egypt(),
3045            "elsalvador" => Country::el_salvador(),
3046            "equatorialguinea" => Country::equatorial_guinea(),
3047            "eritrea" => Country::eritrea(),
3048            "estonia" => Country::estonia(),
3049            "eswatini" => Country::eswatini(),
3050            "ethiopia" => Country::ethiopia(),
3051            "federatedstatesofmicronesia" => Country::federated_states_of_micronesia(),
3052            "fiji" => Country::fiji(),
3053            "finland" => Country::finland(),
3054            "france" => Country::france(),
3055            "frenchguiana" => Country::french_guiana(),
3056            "frenchpartsaintmartin" => Country::french_part_saint_martin(),
3057            "frenchpolynesia" => Country::french_polynesia(),
3058            "gabon" => Country::gabon(),
3059            "georgia" => Country::georgia(),
3060            "germany" => Country::germany(),
3061            "ghana" => Country::ghana(),
3062            "gibraltar" => Country::gibraltar(),
3063            "greece" => Country::greece(),
3064            "greenland" => Country::greenland(),
3065            "grenada" => Country::grenada(),
3066            "guadeloupe" => Country::guadeloupe(),
3067            "guam" => Country::guam(),
3068            "guatemala" => Country::guatemala(),
3069            "guernsey" => Country::guernsey(),
3070            "guinea" => Country::guinea(),
3071            "guineabissau" => Country::guinea_bissau(),
3072            "guyana" => Country::guyana(),
3073            "haiti" => Country::haiti(),
3074            "heardislandandmcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
3075            "honduras" => Country::honduras(),
3076            "hongkong" => Country::hong_kong(),
3077            "hungary" => Country::hungary(),
3078            "iceland" => Country::iceland(),
3079            "india" => Country::india(),
3080            "indonesia" => Country::indonesia(),
3081            "iraq" => Country::iraq(),
3082            "ireland" => Country::ireland(),
3083            "islamicrepublicofiran" => Country::islamic_republic_of_iran(),
3084            "isleofman" => Country::isle_of_man(),
3085            "israel" => Country::israel(),
3086            "italy" => Country::italy(),
3087            "jamaica" => Country::jamaica(),
3088            "japan" => Country::japan(),
3089            "jersey" => Country::jersey(),
3090            "jordan" => Country::jordan(),
3091            "kazakhstan" => Country::kazakhstan(),
3092            "kenya" => Country::kenya(),
3093            "kiribati" => Country::kiribati(),
3094            "kosovo" => Country::kosovo(),
3095            "kuwait" => Country::kuwait(),
3096            "kyrgyzstan" => Country::kyrgyzstan(),
3097            "latvia" => Country::latvia(),
3098            "lebanon" => Country::lebanon(),
3099            "lesotho" => Country::lesotho(),
3100            "liberia" => Country::liberia(),
3101            "libya" => Country::libya(),
3102            "liechtenstein" => Country::liechtenstein(),
3103            "lithuania" => Country::lithuania(),
3104            "luxembourg" => Country::luxembourg(),
3105            "macao" => Country::macao(),
3106            "madagascar" => Country::madagascar(),
3107            "malawi" => Country::malawi(),
3108            "malaysia" => Country::malaysia(),
3109            "maldives" => Country::maldives(),
3110            "mali" => Country::mali(),
3111            "malta" => Country::malta(),
3112            "martinique" => Country::martinique(),
3113            "mauritania" => Country::mauritania(),
3114            "mauritius" => Country::mauritius(),
3115            "mayotte" => Country::mayotte(),
3116            "mexico" => Country::mexico(),
3117            "monaco" => Country::monaco(),
3118            "mongolia" => Country::mongolia(),
3119            "montenegro" => Country::montenegro(),
3120            "montserrat" => Country::montserrat(),
3121            "morocco" => Country::morocco(),
3122            "mozambique" => Country::mozambique(),
3123            "myanmar" => Country::myanmar(),
3124            "namibia" => Country::namibia(),
3125            "nauru" => Country::nauru(),
3126            "nepal" => Country::nepal(),
3127            "newcaledonia" => Country::new_caledonia(),
3128            "newzealand" => Country::new_zealand(),
3129            "nicaragua" => Country::nicaragua(),
3130            "nigeria" => Country::nigeria(),
3131            "niue" => Country::niue(),
3132            "norfolkisland" => Country::norfolk_island(),
3133            "norway" => Country::norway(),
3134            "oman" => Country::oman(),
3135            "pakistan" => Country::pakistan(),
3136            "palau" => Country::palau(),
3137            "panama" => Country::panama(),
3138            "papuanewguinea" => Country::papua_new_guinea(),
3139            "paraguay" => Country::paraguay(),
3140            "peru" => Country::peru(),
3141            "pitcairn" => Country::pitcairn(),
3142            "poland" => Country::poland(),
3143            "portugal" => Country::portugal(),
3144            "puertorico" => Country::puerto_rico(),
3145            "qatar" => Country::qatar(),
3146            "republicofnorthmacedonia" => Country::republic_of_north_macedonia(),
3147            "reunion" => Country::reunion(),
3148            "romania" => Country::romania(),
3149            "rwanda" => Country::rwanda(),
3150            "saintbarthelemy" => Country::saint_barthelemy(),
3151            "saintkittsandnevis" => Country::saint_kitts_and_nevis(),
3152            "saintlucia" => Country::saint_lucia(),
3153            "saintpierreandmiquelon" => Country::saint_pierre_and_miquelon(),
3154            "saintvincentandthegrenadines" => Country::saint_vincent_and_the_grenadines(),
3155            "samoa" => Country::samoa(),
3156            "sanmarino" => Country::san_marino(),
3157            "saotomeandprincipe" => Country::sao_tome_and_principe(),
3158            "saudiarabia" => Country::saudi_arabia(),
3159            "senegal" => Country::senegal(),
3160            "serbia" => Country::serbia(),
3161            "seychelles" => Country::seychelles(),
3162            "sierraleone" => Country::sierra_leone(),
3163            "singapore" => Country::singapore(),
3164            "slovakia" => Country::slovakia(),
3165            "slovenia" => Country::slovenia(),
3166            "solomonislands" => Country::solomon_islands(),
3167            "somalia" => Country::somalia(),
3168            "southafrica" => Country::south_africa(),
3169            "southgeorgiaandthesouthsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
3170            "southsudan" => Country::south_sudan(),
3171            "spain" => Country::spain(),
3172            "srilanka" => Country::sri_lanka(),
3173            "stateofpalestine" => Country::state_of_palestine(),
3174            "suriname" => Country::suriname(),
3175            "svalbardandjanmayen" => Country::svalbard_and_jan_mayen(),
3176            "sweden" => Country::sweden(),
3177            "switzerland" => Country::switzerland(),
3178            "syrianarabrepublic" => Country::syrian_arab_republic(),
3179            "taiwan,republicofchina" => Country::taiwan(),
3180            "tajikistan" => Country::tajikistan(),
3181            "thailand" => Country::thailand(),
3182            "thebahamas" => Country::the_bahamas(),
3183            "thecaymanislands" => Country::the_cayman_islands(),
3184            "thecentralafricanrepublic" => Country::the_central_african_republic(),
3185            "thecocoskeelingislands" => Country::the_cocos_keeling_islands(),
3186            "thecomoros" => Country::the_comoros(),
3187            "thecongo" => Country::the_congo(),
3188            "thecookislands" => Country::the_cook_islands(),
3189            "thedemocraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
3190            "thedemocraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
3191            "thedominicanrepublic" => Country::the_dominican_republic(),
3192            "thefalklandislandsmalvinas" => Country::the_falkland_islands_malvinas(),
3193            "thefaroeislands" => Country::the_faroe_islands(),
3194            "thefrenchsouthernterritories" => Country::the_french_southern_territories(),
3195            "thegambia" => Country::the_gambia(),
3196            "theholysee" => Country::the_holy_see(),
3197            "thelaopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
3198            "themarshallislands" => Country::the_marshall_islands(),
3199            "thenetherlands" => Country::the_netherlands(),
3200            "theniger" => Country::the_niger(),
3201            "thenorthernmarianaislands" => Country::the_northern_mariana_islands(),
3202            "thephilippines" => Country::the_philippines(),
3203            "therepublicofkorea" => Country::the_republic_of_korea(),
3204            "therepublicofmoldova" => Country::the_republic_of_moldova(),
3205            "therussianfederation" => Country::the_russian_federation(),
3206            "thesudan" => Country::the_sudan(),
3207            "theturksandcaicosislands" => Country::the_turks_and_caicos_islands(),
3208            "theunitedarabemirates" => Country::the_united_arab_emirates(),
3209            "theunitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
3210            "theunitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
3211            "theunitedstatesofamerica" => Country::the_united_states_of_america(),
3212            "timorleste" => Country::timor_leste(),
3213            "easttimor" => Country::timor_leste(),
3214            "togo" => Country::togo(),
3215            "tokelau" => Country::tokelau(),
3216            "tonga" => Country::tonga(),
3217            "trinidadandtobago" => Country::trinidad_and_tobago(),
3218            "tunisia" => Country::tunisia(),
3219            "turkey" => Country::turkey(),
3220            "türkiye" => Country::turkey(),
3221            "turkmenistan" => Country::turkmenistan(),
3222            "tuvalu" => Country::tuvalu(),
3223            "usvirginislands" => Country::us_virgin_islands(),
3224            "uganda" => Country::uganda(),
3225            "ukraine" => Country::ukraine(),
3226            "unitedrepublicoftanzania" => Country::united_republic_of_tanzania(),
3227            "uruguay" => Country::uruguay(),
3228            "uzbekistan" => Country::uzbekistan(),
3229            "vanuatu" => Country::vanuatu(),
3230            "vietnam" => Country::vietnam(),
3231            "wallisandfutuna" => Country::wallis_and_futuna(),
3232            "westernsahara" => Country::western_sahara(),
3233            "yemen" => Country::yemen(),
3234            "zambia" => Country::zambia(),
3235            "zimbabwe" => Country::zimbabwe(),
3236        };
3237        lookup_ascii_lowercase(&NAMES, name.as_ref())
3238            .copied()
3239            .ok_or("unknown value")
3240    }
3241}
3242
3243impl FromStr for Country {
3244    type Err = &'static str;
3245
3246    #[allow(clippy::too_many_lines)]
3247    fn from_str(code: &str) -> Result<Self, &'static str> {
3248        static CODES: Map<&'static str, Country> = phf_map! {
3249            "afghanistan" => Country::afghanistan(),
3250            "004" => Country::afghanistan(),
3251            "af" => Country::afghanistan(),
3252            "afg" => Country::afghanistan(),
3253            "alandislands" => Country::aland_islands(),
3254            "aland_islands" => Country::aland_islands(),
3255            "248" => Country::aland_islands(),
3256            "ax" => Country::aland_islands(),
3257            "ala" => Country::aland_islands(),
3258            "albania" => Country::albania(),
3259            "008" => Country::albania(),
3260            "al" => Country::albania(),
3261            "alb" => Country::albania(),
3262            "algeria" => Country::algeria(),
3263            "012" => Country::algeria(),
3264            "dz" => Country::algeria(),
3265            "dza" => Country::algeria(),
3266            "americansamoa" => Country::american_samoa(),
3267            "american_samoa" => Country::american_samoa(),
3268            "016" => Country::american_samoa(),
3269            "as" => Country::american_samoa(),
3270            "asm" => Country::american_samoa(),
3271            "andorra" => Country::andorra(),
3272            "020" => Country::andorra(),
3273            "ad" => Country::andorra(),
3274            "and" => Country::andorra(),
3275            "angola" => Country::angola(),
3276            "024" => Country::angola(),
3277            "ao" => Country::angola(),
3278            "ago" => Country::angola(),
3279            "anguilla" => Country::anguilla(),
3280            "660" => Country::anguilla(),
3281            "ai" => Country::anguilla(),
3282            "aia" => Country::anguilla(),
3283            "antarctica" => Country::antarctica(),
3284            "010" => Country::antarctica(),
3285            "aq" => Country::antarctica(),
3286            "ata" => Country::antarctica(),
3287            "antiguaandbarbuda" => Country::antigua_and_barbuda(),
3288            "antigua_and_barbuda" => Country::antigua_and_barbuda(),
3289            "028" => Country::antigua_and_barbuda(),
3290            "ag" => Country::antigua_and_barbuda(),
3291            "atg" => Country::antigua_and_barbuda(),
3292            "argentina" => Country::argentina(),
3293            "032" => Country::argentina(),
3294            "ar" => Country::argentina(),
3295            "arg" => Country::argentina(),
3296            "armenia" => Country::armenia(),
3297            "051" => Country::armenia(),
3298            "am" => Country::armenia(),
3299            "arm" => Country::armenia(),
3300            "aruba" => Country::aruba(),
3301            "533" => Country::aruba(),
3302            "aw" => Country::aruba(),
3303            "abw" => Country::aruba(),
3304            "ascensionandtristandacunhasainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3305            "ascension_and_tristan_da_cunha_saint_helena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3306            "654" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3307            "sh" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3308            "shn" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3309            "sthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3310            "sainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3311            "australia" => Country::australia(),
3312            "036" => Country::australia(),
3313            "au" => Country::australia(),
3314            "aus" => Country::australia(),
3315            "austria" => Country::austria(),
3316            "040" => Country::austria(),
3317            "at" => Country::austria(),
3318            "aut" => Country::austria(),
3319            "azerbaijan" => Country::azerbaijan(),
3320            "031" => Country::azerbaijan(),
3321            "az" => Country::azerbaijan(),
3322            "aze" => Country::azerbaijan(),
3323            "bahrain" => Country::bahrain(),
3324            "048" => Country::bahrain(),
3325            "bh" => Country::bahrain(),
3326            "bhr" => Country::bahrain(),
3327            "bangladesh" => Country::bangladesh(),
3328            "050" => Country::bangladesh(),
3329            "bd" => Country::bangladesh(),
3330            "bgd" => Country::bangladesh(),
3331            "barbados" => Country::barbados(),
3332            "052" => Country::barbados(),
3333            "bb" => Country::barbados(),
3334            "brb" => Country::barbados(),
3335            "belarus" => Country::belarus(),
3336            "112" => Country::belarus(),
3337            "by" => Country::belarus(),
3338            "blr" => Country::belarus(),
3339            "belgium" => Country::belgium(),
3340            "056" => Country::belgium(),
3341            "be" => Country::belgium(),
3342            "bel" => Country::belgium(),
3343            "belize" => Country::belize(),
3344            "084" => Country::belize(),
3345            "bz" => Country::belize(),
3346            "blz" => Country::belize(),
3347            "benin" => Country::benin(),
3348            "204" => Country::benin(),
3349            "bj" => Country::benin(),
3350            "ben" => Country::benin(),
3351            "bermuda" => Country::bermuda(),
3352            "060" => Country::bermuda(),
3353            "bm" => Country::bermuda(),
3354            "bmu" => Country::bermuda(),
3355            "bhutan" => Country::bhutan(),
3356            "064" => Country::bhutan(),
3357            "bt" => Country::bhutan(),
3358            "btn" => Country::bhutan(),
3359            "bolivarianrepublicofvenezuela" => Country::bolivarian_republic_of_venezuela(),
3360            "bolivarian_republic_of_venezuela" => Country::bolivarian_republic_of_venezuela(),
3361            "862" => Country::bolivarian_republic_of_venezuela(),
3362            "ve" => Country::bolivarian_republic_of_venezuela(),
3363            "ven" => Country::bolivarian_republic_of_venezuela(),
3364            "venezuela" => Country::bolivarian_republic_of_venezuela(),
3365            "bolivia" => Country::bolivia(),
3366            "068" => Country::bolivia(),
3367            "bo" => Country::bolivia(),
3368            "bol" => Country::bolivia(),
3369            "bonaire" => Country::bonaire(),
3370            "535" => Country::bonaire(),
3371            "bq" => Country::bonaire(),
3372            "bes" => Country::bonaire(),
3373            "bosniaandherzegovina" => Country::bosnia_and_herzegovina(),
3374            "bosnia_and_herzegovina" => Country::bosnia_and_herzegovina(),
3375            "070" => Country::bosnia_and_herzegovina(),
3376            "ba" => Country::bosnia_and_herzegovina(),
3377            "bih" => Country::bosnia_and_herzegovina(),
3378            "bosnia" => Country::bosnia_and_herzegovina(),
3379            "herzegovina" => Country::bosnia_and_herzegovina(),
3380            "botswana" => Country::botswana(),
3381            "072" => Country::botswana(),
3382            "bw" => Country::botswana(),
3383            "bwa" => Country::botswana(),
3384            "bouvetisland" => Country::bouvet_island(),
3385            "bouvet_island" => Country::bouvet_island(),
3386            "074" => Country::bouvet_island(),
3387            "bv" => Country::bouvet_island(),
3388            "bvt" => Country::bouvet_island(),
3389            "brazil" => Country::brazil(),
3390            "076" => Country::brazil(),
3391            "br" => Country::brazil(),
3392            "bra" => Country::brazil(),
3393            "britishindianoceanterritory" => Country::british_indian_ocean_territory(),
3394            "british_indian_ocean_territory" => Country::british_indian_ocean_territory(),
3395            "086" => Country::british_indian_ocean_territory(),
3396            "io" => Country::british_indian_ocean_territory(),
3397            "iot" => Country::british_indian_ocean_territory(),
3398            "britishvirginislands" => Country::british_virgin_islands(),
3399            "british_virgin_islands" => Country::british_virgin_islands(),
3400            "092" => Country::british_virgin_islands(),
3401            "vg" => Country::british_virgin_islands(),
3402            "vgb" => Country::british_virgin_islands(),
3403            "bruneidarussalam" => Country::brunei_darussalam(),
3404            "brunei_darussalam" => Country::brunei_darussalam(),
3405            "096" => Country::brunei_darussalam(),
3406            "bn" => Country::brunei_darussalam(),
3407            "brn" => Country::brunei_darussalam(),
3408            "brunei" => Country::brunei_darussalam(),
3409            "bulgaria" => Country::bulgaria(),
3410            "100" => Country::bulgaria(),
3411            "bg" => Country::bulgaria(),
3412            "bgr" => Country::bulgaria(),
3413            "burkinafaso" => Country::burkina_faso(),
3414            "burkina_faso" => Country::burkina_faso(),
3415            "854" => Country::burkina_faso(),
3416            "bf" => Country::burkina_faso(),
3417            "bfa" => Country::burkina_faso(),
3418            "burkina" => Country::burkina_faso(),
3419            "burundi" => Country::burundi(),
3420            "108" => Country::burundi(),
3421            "bi" => Country::burundi(),
3422            "bdi" => Country::burundi(),
3423            "caboverde" => Country::cabo_verde(),
3424            "cabo_verde" => Country::cabo_verde(),
3425            "132" => Country::cabo_verde(),
3426            "cv" => Country::cabo_verde(),
3427            "cpv" => Country::cabo_verde(),
3428            "capeverde" => Country::cabo_verde(),
3429            "cape_verde" => Country::cabo_verde(),
3430            "cambodia" => Country::cambodia(),
3431            "116" => Country::cambodia(),
3432            "kh" => Country::cambodia(),
3433            "khm" => Country::cambodia(),
3434            "cameroon" => Country::cameroon(),
3435            "120" => Country::cameroon(),
3436            "cm" => Country::cameroon(),
3437            "cmr" => Country::cameroon(),
3438            "canada" => Country::canada(),
3439            "124" => Country::canada(),
3440            "ca" => Country::canada(),
3441            "can" => Country::canada(),
3442            "chad" => Country::chad(),
3443            "148" => Country::chad(),
3444            "td" => Country::chad(),
3445            "tcd" => Country::chad(),
3446            "chile" => Country::chile(),
3447            "152" => Country::chile(),
3448            "cl" => Country::chile(),
3449            "chl" => Country::chile(),
3450            "china" => Country::china(),
3451            "156" => Country::china(),
3452            "cn" => Country::china(),
3453            "chn" => Country::china(),
3454            "christmasisland" => Country::christmas_island(),
3455            "christmas_island" => Country::christmas_island(),
3456            "162" => Country::christmas_island(),
3457            "cx" => Country::christmas_island(),
3458            "cxr" => Country::christmas_island(),
3459            "colombia" => Country::colombia(),
3460            "170" => Country::colombia(),
3461            "co" => Country::colombia(),
3462            "col" => Country::colombia(),
3463            "costarica" => Country::costa_rica(),
3464            "costa_rica" => Country::costa_rica(),
3465            "188" => Country::costa_rica(),
3466            "cr" => Country::costa_rica(),
3467            "cri" => Country::costa_rica(),
3468            "cotedivoire" => Country::coted_ivoire(),
3469            "coted_ivoire" => Country::coted_ivoire(),
3470            "384" => Country::coted_ivoire(),
3471            "ci" => Country::coted_ivoire(),
3472            "civ" => Country::coted_ivoire(),
3473            "ivorycoast" => Country::coted_ivoire(),
3474            "ivory_coast" => Country::coted_ivoire(),
3475            "croatia" => Country::croatia(),
3476            "191" => Country::croatia(),
3477            "hr" => Country::croatia(),
3478            "hrv" => Country::croatia(),
3479            "cuba" => Country::cuba(),
3480            "192" => Country::cuba(),
3481            "cu" => Country::cuba(),
3482            "cub" => Country::cuba(),
3483            "curacao" => Country::curacao(),
3484            "531" => Country::curacao(),
3485            "cw" => Country::curacao(),
3486            "cuw" => Country::curacao(),
3487            "cyprus" => Country::cyprus(),
3488            "196" => Country::cyprus(),
3489            "cy" => Country::cyprus(),
3490            "cyp" => Country::cyprus(),
3491            "czechia" => Country::czechia(),
3492            "czechrepublic" => Country::czechia(),
3493            "203" => Country::czechia(),
3494            "cz" => Country::czechia(),
3495            "cze" => Country::czechia(),
3496            "denmark" => Country::denmark(),
3497            "208" => Country::denmark(),
3498            "dk" => Country::denmark(),
3499            "dnk" => Country::denmark(),
3500            "djibouti" => Country::djibouti(),
3501            "262" => Country::djibouti(),
3502            "dj" => Country::djibouti(),
3503            "dji" => Country::djibouti(),
3504            "dominica" => Country::dominica(),
3505            "212" => Country::dominica(),
3506            "dm" => Country::dominica(),
3507            "dma" => Country::dominica(),
3508            "dutchpartsintmaarten" => Country::dutch_part_sint_maarten(),
3509            "dutch_part_sint_maarten" => Country::dutch_part_sint_maarten(),
3510            "534" => Country::dutch_part_sint_maarten(),
3511            "sx" => Country::dutch_part_sint_maarten(),
3512            "sxm" => Country::dutch_part_sint_maarten(),
3513            "stmaarten" => Country::dutch_part_sint_maarten(),
3514            "sintmaarten" => Country::dutch_part_sint_maarten(),
3515            "ecuador" => Country::ecuador(),
3516            "218" => Country::ecuador(),
3517            "ec" => Country::ecuador(),
3518            "ecu" => Country::ecuador(),
3519            "egypt" => Country::egypt(),
3520            "818" => Country::egypt(),
3521            "eg" => Country::egypt(),
3522            "egy" => Country::egypt(),
3523            "elsalvador" => Country::el_salvador(),
3524            "el_salvador" => Country::el_salvador(),
3525            "222" => Country::el_salvador(),
3526            "sv" => Country::el_salvador(),
3527            "slv" => Country::el_salvador(),
3528            "equatorialguinea" => Country::equatorial_guinea(),
3529            "equatorial_guinea" => Country::equatorial_guinea(),
3530            "226" => Country::equatorial_guinea(),
3531            "gq" => Country::equatorial_guinea(),
3532            "gnq" => Country::equatorial_guinea(),
3533            "eritrea" => Country::eritrea(),
3534            "232" => Country::eritrea(),
3535            "er" => Country::eritrea(),
3536            "eri" => Country::eritrea(),
3537            "estonia" => Country::estonia(),
3538            "233" => Country::estonia(),
3539            "ee" => Country::estonia(),
3540            "est" => Country::estonia(),
3541            "eswatini" => Country::eswatini(),
3542            "748" => Country::eswatini(),
3543            "sz" => Country::eswatini(),
3544            "swz" => Country::eswatini(),
3545            "swaziland" => Country::eswatini(),
3546            "ethiopia" => Country::ethiopia(),
3547            "231" => Country::ethiopia(),
3548            "et" => Country::ethiopia(),
3549            "eth" => Country::ethiopia(),
3550            "federatedstatesofmicronesia" => Country::federated_states_of_micronesia(),
3551            "federated_states_of_micronesia" => Country::federated_states_of_micronesia(),
3552            "583" => Country::federated_states_of_micronesia(),
3553            "fm" => Country::federated_states_of_micronesia(),
3554            "fsm" => Country::federated_states_of_micronesia(),
3555            "micronesia" => Country::federated_states_of_micronesia(),
3556            "fiji" => Country::fiji(),
3557            "242" => Country::fiji(),
3558            "fj" => Country::fiji(),
3559            "fji" => Country::fiji(),
3560            "finland" => Country::finland(),
3561            "246" => Country::finland(),
3562            "fi" => Country::finland(),
3563            "fin" => Country::finland(),
3564            "france" => Country::france(),
3565            "250" => Country::france(),
3566            "fr" => Country::france(),
3567            "fra" => Country::france(),
3568            "frenchguiana" => Country::french_guiana(),
3569            "french_guiana" => Country::french_guiana(),
3570            "254" => Country::french_guiana(),
3571            "gf" => Country::french_guiana(),
3572            "guf" => Country::french_guiana(),
3573            "frenchpartsaintmartin" => Country::french_part_saint_martin(),
3574            "french_part_saint_martin" => Country::french_part_saint_martin(),
3575            "663" => Country::french_part_saint_martin(),
3576            "mf" => Country::french_part_saint_martin(),
3577            "maf" => Country::french_part_saint_martin(),
3578            "stmartin" => Country::french_part_saint_martin(),
3579            "saintmartin" => Country::french_part_saint_martin(),
3580            "frenchpolynesia" => Country::french_polynesia(),
3581            "258" => Country::french_polynesia(),
3582            "pf" => Country::french_polynesia(),
3583            "pyf" => Country::french_polynesia(),
3584            "gabon" => Country::gabon(),
3585            "266" => Country::gabon(),
3586            "ga" => Country::gabon(),
3587            "gab" => Country::gabon(),
3588            "georgia" => Country::georgia(),
3589            "268" => Country::georgia(),
3590            "ge" => Country::georgia(),
3591            "geo" => Country::georgia(),
3592            "germany" => Country::germany(),
3593            "276" => Country::germany(),
3594            "de" => Country::germany(),
3595            "deu" => Country::germany(),
3596            "ghana" => Country::ghana(),
3597            "288" => Country::ghana(),
3598            "gh" => Country::ghana(),
3599            "gha" => Country::ghana(),
3600            "gibraltar" => Country::gibraltar(),
3601            "292" => Country::gibraltar(),
3602            "gi" => Country::gibraltar(),
3603            "gib" => Country::gibraltar(),
3604            "greece" => Country::greece(),
3605            "300" => Country::greece(),
3606            "gr" => Country::greece(),
3607            "grc" => Country::greece(),
3608            "greenland" => Country::greenland(),
3609            "304" => Country::greenland(),
3610            "gl" => Country::greenland(),
3611            "grl" => Country::greenland(),
3612            "grenada" => Country::grenada(),
3613            "308" => Country::grenada(),
3614            "gd" => Country::grenada(),
3615            "grd" => Country::grenada(),
3616            "guadeloupe" => Country::guadeloupe(),
3617            "312" => Country::guadeloupe(),
3618            "gp" => Country::guadeloupe(),
3619            "glp" => Country::guadeloupe(),
3620            "guam" => Country::guam(),
3621            "316" => Country::guam(),
3622            "gu" => Country::guam(),
3623            "gum" => Country::guam(),
3624            "guatemala" => Country::guatemala(),
3625            "320" => Country::guatemala(),
3626            "gt" => Country::guatemala(),
3627            "gtm" => Country::guatemala(),
3628            "guernsey" => Country::guernsey(),
3629            "831" => Country::guernsey(),
3630            "gg" => Country::guernsey(),
3631            "ggy" => Country::guernsey(),
3632            "guinea" => Country::guinea(),
3633            "324" => Country::guinea(),
3634            "gn" => Country::guinea(),
3635            "gin" => Country::guinea(),
3636            "guineabissau" => Country::guinea_bissau(),
3637            "guinea_bissau" => Country::guinea_bissau(),
3638            "624" => Country::guinea_bissau(),
3639            "gw" => Country::guinea_bissau(),
3640            "gnb" => Country::guinea_bissau(),
3641            "guyana" => Country::guyana(),
3642            "328" => Country::guyana(),
3643            "gy" => Country::guyana(),
3644            "guy" => Country::guyana(),
3645            "haiti" => Country::haiti(),
3646            "332" => Country::haiti(),
3647            "ht" => Country::haiti(),
3648            "hti" => Country::haiti(),
3649            "heardislandandmcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
3650            "heard_island_and_mc_donald_islands" => Country::heard_island_and_mc_donald_islands(),
3651            "334" => Country::heard_island_and_mc_donald_islands(),
3652            "hm" => Country::heard_island_and_mc_donald_islands(),
3653            "hmd" => Country::heard_island_and_mc_donald_islands(),
3654            "heardisland" => Country::heard_island_and_mc_donald_islands(),
3655            "mcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
3656            "honduras" => Country::honduras(),
3657            "340" => Country::honduras(),
3658            "hn" => Country::honduras(),
3659            "hnd" => Country::honduras(),
3660            "hongkong" => Country::hong_kong(),
3661            "hong_kong" => Country::hong_kong(),
3662            "344" => Country::hong_kong(),
3663            "hk" => Country::hong_kong(),
3664            "hkg" => Country::hong_kong(),
3665            "hungary" => Country::hungary(),
3666            "348" => Country::hungary(),
3667            "hu" => Country::hungary(),
3668            "hun" => Country::hungary(),
3669            "iceland" => Country::iceland(),
3670            "352" => Country::iceland(),
3671            "is" => Country::iceland(),
3672            "isl" => Country::iceland(),
3673            "india" => Country::india(),
3674            "356" => Country::india(),
3675            "in" => Country::india(),
3676            "ind" => Country::india(),
3677            "indonesia" => Country::indonesia(),
3678            "360" => Country::indonesia(),
3679            "id" => Country::indonesia(),
3680            "idn" => Country::indonesia(),
3681            "iraq" => Country::iraq(),
3682            "368" => Country::iraq(),
3683            "iq" => Country::iraq(),
3684            "irq" => Country::iraq(),
3685            "ireland" => Country::ireland(),
3686            "372" => Country::ireland(),
3687            "ie" => Country::ireland(),
3688            "irl" => Country::ireland(),
3689            "islamicrepublicofiran" => Country::islamic_republic_of_iran(),
3690            "islamic_republic_of_iran" => Country::islamic_republic_of_iran(),
3691            "364" => Country::islamic_republic_of_iran(),
3692            "ir" => Country::islamic_republic_of_iran(),
3693            "irn" => Country::islamic_republic_of_iran(),
3694            "iran" => Country::islamic_republic_of_iran(),
3695            "isleofman" => Country::isle_of_man(),
3696            "isle_of_man" => Country::isle_of_man(),
3697            "833" => Country::isle_of_man(),
3698            "im" => Country::isle_of_man(),
3699            "imn" => Country::isle_of_man(),
3700            "israel" => Country::israel(),
3701            "376" => Country::israel(),
3702            "il" => Country::israel(),
3703            "isr" => Country::israel(),
3704            "italy" => Country::italy(),
3705            "380" => Country::italy(),
3706            "it" => Country::italy(),
3707            "ita" => Country::italy(),
3708            "jamaica" => Country::jamaica(),
3709            "388" => Country::jamaica(),
3710            "jm" => Country::jamaica(),
3711            "jam" => Country::jamaica(),
3712            "japan" => Country::japan(),
3713            "392" => Country::japan(),
3714            "jp" => Country::japan(),
3715            "jpn" => Country::japan(),
3716            "jersey" => Country::jersey(),
3717            "832" => Country::jersey(),
3718            "je" => Country::jersey(),
3719            "jey" => Country::jersey(),
3720            "jordan" => Country::jordan(),
3721            "400" => Country::jordan(),
3722            "jo" => Country::jordan(),
3723            "jor" => Country::jordan(),
3724            "kazakhstan" => Country::kazakhstan(),
3725            "398" => Country::kazakhstan(),
3726            "kz" => Country::kazakhstan(),
3727            "kaz" => Country::kazakhstan(),
3728            "kenya" => Country::kenya(),
3729            "404" => Country::kenya(),
3730            "ke" => Country::kenya(),
3731            "ken" => Country::kenya(),
3732            "kiribati" => Country::kiribati(),
3733            "296" => Country::kiribati(),
3734            "ki" => Country::kiribati(),
3735            "kir" => Country::kiribati(),
3736            "kosovo" => Country::kosovo(),
3737            "383" => Country::kosovo(),
3738            "xk" => Country::kosovo(),
3739            "xkx" => Country::kosovo(),
3740            "kuwait" => Country::kuwait(),
3741            "414" => Country::kuwait(),
3742            "kw" => Country::kuwait(),
3743            "kwt" => Country::kuwait(),
3744            "kyrgyzstan" => Country::kyrgyzstan(),
3745            "417" => Country::kyrgyzstan(),
3746            "kg" => Country::kyrgyzstan(),
3747            "kgz" => Country::kyrgyzstan(),
3748            "latvia" => Country::latvia(),
3749            "428" => Country::latvia(),
3750            "lv" => Country::latvia(),
3751            "lva" => Country::latvia(),
3752            "lebanon" => Country::lebanon(),
3753            "422" => Country::lebanon(),
3754            "lb" => Country::lebanon(),
3755            "lbn" => Country::lebanon(),
3756            "lesotho" => Country::lesotho(),
3757            "426" => Country::lesotho(),
3758            "ls" => Country::lesotho(),
3759            "lso" => Country::lesotho(),
3760            "liberia" => Country::liberia(),
3761            "430" => Country::liberia(),
3762            "lr" => Country::liberia(),
3763            "lbr" => Country::liberia(),
3764            "libya" => Country::libya(),
3765            "434" => Country::libya(),
3766            "ly" => Country::libya(),
3767            "lby" => Country::libya(),
3768            "liechtenstein" => Country::liechtenstein(),
3769            "438" => Country::liechtenstein(),
3770            "li" => Country::liechtenstein(),
3771            "lie" => Country::liechtenstein(),
3772            "lithuania" => Country::lithuania(),
3773            "440" => Country::lithuania(),
3774            "lt" => Country::lithuania(),
3775            "ltu" => Country::lithuania(),
3776            "luxembourg" => Country::luxembourg(),
3777            "442" => Country::luxembourg(),
3778            "lu" => Country::luxembourg(),
3779            "lux" => Country::luxembourg(),
3780            "macao" => Country::macao(),
3781            "446" => Country::macao(),
3782            "mo" => Country::macao(),
3783            "mac" => Country::macao(),
3784            "macau" => Country::macao(),
3785            "madagascar" => Country::madagascar(),
3786            "450" => Country::madagascar(),
3787            "mg" => Country::madagascar(),
3788            "mdg" => Country::madagascar(),
3789            "malawi" => Country::malawi(),
3790            "454" => Country::malawi(),
3791            "mw" => Country::malawi(),
3792            "mwi" => Country::malawi(),
3793            "malaysia" => Country::malaysia(),
3794            "458" => Country::malaysia(),
3795            "my" => Country::malaysia(),
3796            "mys" => Country::malaysia(),
3797            "maldives" => Country::maldives(),
3798            "462" => Country::maldives(),
3799            "mv" => Country::maldives(),
3800            "mdv" => Country::maldives(),
3801            "mali" => Country::mali(),
3802            "466" => Country::mali(),
3803            "ml" => Country::mali(),
3804            "mli" => Country::mali(),
3805            "malta" => Country::malta(),
3806            "470" => Country::malta(),
3807            "mt" => Country::malta(),
3808            "mlt" => Country::malta(),
3809            "martinique" => Country::martinique(),
3810            "474" => Country::martinique(),
3811            "mq" => Country::martinique(),
3812            "mtq" => Country::martinique(),
3813            "mauritania" => Country::mauritania(),
3814            "478" => Country::mauritania(),
3815            "mr" => Country::mauritania(),
3816            "mrt" => Country::mauritania(),
3817            "mauritius" => Country::mauritius(),
3818            "480" => Country::mauritius(),
3819            "mu" => Country::mauritius(),
3820            "mus" => Country::mauritius(),
3821            "mayotte" => Country::mayotte(),
3822            "175" => Country::mayotte(),
3823            "yt" => Country::mayotte(),
3824            "myt" => Country::mayotte(),
3825            "mexico" => Country::mexico(),
3826            "484" => Country::mexico(),
3827            "mx" => Country::mexico(),
3828            "mex" => Country::mexico(),
3829            "monaco" => Country::monaco(),
3830            "492" => Country::monaco(),
3831            "mc" => Country::monaco(),
3832            "mco" => Country::monaco(),
3833            "mongolia" => Country::mongolia(),
3834            "496" => Country::mongolia(),
3835            "mn" => Country::mongolia(),
3836            "mng" => Country::mongolia(),
3837            "montenegro" => Country::montenegro(),
3838            "499" => Country::montenegro(),
3839            "me" => Country::montenegro(),
3840            "mne" => Country::montenegro(),
3841            "montserrat" => Country::montserrat(),
3842            "500" => Country::montserrat(),
3843            "ms" => Country::montserrat(),
3844            "msr" => Country::montserrat(),
3845            "morocco" => Country::morocco(),
3846            "504" => Country::morocco(),
3847            "ma" => Country::morocco(),
3848            "mar" => Country::morocco(),
3849            "mozambique" => Country::mozambique(),
3850            "508" => Country::mozambique(),
3851            "mz" => Country::mozambique(),
3852            "moz" => Country::mozambique(),
3853            "myanmar" => Country::myanmar(),
3854            "104" => Country::myanmar(),
3855            "mm" => Country::myanmar(),
3856            "mmr" => Country::myanmar(),
3857            "burma" => Country::myanmar(),
3858            "namibia" => Country::namibia(),
3859            "516" => Country::namibia(),
3860            "na" => Country::namibia(),
3861            "nam" => Country::namibia(),
3862            "nauru" => Country::nauru(),
3863            "520" => Country::nauru(),
3864            "nr" => Country::nauru(),
3865            "nru" => Country::nauru(),
3866            "nepal" => Country::nepal(),
3867            "524" => Country::nepal(),
3868            "np" => Country::nepal(),
3869            "npl" => Country::nepal(),
3870            "newcaledonia" => Country::new_caledonia(),
3871            "new_caledonia" => Country::new_caledonia(),
3872            "540" => Country::new_caledonia(),
3873            "nc" => Country::new_caledonia(),
3874            "ncl" => Country::new_caledonia(),
3875            "newzealand" => Country::new_zealand(),
3876            "new_zealand" => Country::new_zealand(),
3877            "554" => Country::new_zealand(),
3878            "nz" => Country::new_zealand(),
3879            "nzl" => Country::new_zealand(),
3880            "nicaragua" => Country::nicaragua(),
3881            "558" => Country::nicaragua(),
3882            "ni" => Country::nicaragua(),
3883            "nic" => Country::nicaragua(),
3884            "nigeria" => Country::nigeria(),
3885            "566" => Country::nigeria(),
3886            "ng" => Country::nigeria(),
3887            "nga" => Country::nigeria(),
3888            "niue" => Country::niue(),
3889            "570" => Country::niue(),
3890            "nu" => Country::niue(),
3891            "niu" => Country::niue(),
3892            "norfolkisland" => Country::norfolk_island(),
3893            "norfolk_island" => Country::norfolk_island(),
3894            "574" => Country::norfolk_island(),
3895            "nf" => Country::norfolk_island(),
3896            "nfk" => Country::norfolk_island(),
3897            "norway" => Country::norway(),
3898            "578" => Country::norway(),
3899            "no" => Country::norway(),
3900            "nor" => Country::norway(),
3901            "oman" => Country::oman(),
3902            "512" => Country::oman(),
3903            "om" => Country::oman(),
3904            "omn" => Country::oman(),
3905            "pakistan" => Country::pakistan(),
3906            "586" => Country::pakistan(),
3907            "pk" => Country::pakistan(),
3908            "pak" => Country::pakistan(),
3909            "palau" => Country::palau(),
3910            "585" => Country::palau(),
3911            "pw" => Country::palau(),
3912            "plw" => Country::palau(),
3913            "panama" => Country::panama(),
3914            "591" => Country::panama(),
3915            "pa" => Country::panama(),
3916            "pan" => Country::panama(),
3917            "papuanewguinea" => Country::papua_new_guinea(),
3918            "papua_new_guinea" => Country::papua_new_guinea(),
3919            "598" => Country::papua_new_guinea(),
3920            "pg" => Country::papua_new_guinea(),
3921            "png" => Country::papua_new_guinea(),
3922            "paraguay" => Country::paraguay(),
3923            "600" => Country::paraguay(),
3924            "py" => Country::paraguay(),
3925            "pry" => Country::paraguay(),
3926            "peru" => Country::peru(),
3927            "604" => Country::peru(),
3928            "pe" => Country::peru(),
3929            "per" => Country::peru(),
3930            "pitcairn" => Country::pitcairn(),
3931            "612" => Country::pitcairn(),
3932            "pn" => Country::pitcairn(),
3933            "pcn" => Country::pitcairn(),
3934            "poland" => Country::poland(),
3935            "616" => Country::poland(),
3936            "pl" => Country::poland(),
3937            "pol" => Country::poland(),
3938            "portugal" => Country::portugal(),
3939            "620" => Country::portugal(),
3940            "pt" => Country::portugal(),
3941            "prt" => Country::portugal(),
3942            "puertorico" => Country::puerto_rico(),
3943            "puerto_rico" => Country::puerto_rico(),
3944            "630" => Country::puerto_rico(),
3945            "pr" => Country::puerto_rico(),
3946            "pri" => Country::puerto_rico(),
3947            "qatar" => Country::qatar(),
3948            "634" => Country::qatar(),
3949            "qa" => Country::qatar(),
3950            "qat" => Country::qatar(),
3951            "republicofnorthmacedonia" => Country::republic_of_north_macedonia(),
3952            "republic_of_north_macedonia" => Country::republic_of_north_macedonia(),
3953            "807" => Country::republic_of_north_macedonia(),
3954            "mk" => Country::republic_of_north_macedonia(),
3955            "mkd" => Country::republic_of_north_macedonia(),
3956            "macedonia" => Country::republic_of_north_macedonia(),
3957            "reunion" => Country::reunion(),
3958            "638" => Country::reunion(),
3959            "re" => Country::reunion(),
3960            "reu" => Country::reunion(),
3961            "romania" => Country::romania(),
3962            "642" => Country::romania(),
3963            "ro" => Country::romania(),
3964            "rou" => Country::romania(),
3965            "rwanda" => Country::rwanda(),
3966            "646" => Country::rwanda(),
3967            "rw" => Country::rwanda(),
3968            "rwa" => Country::rwanda(),
3969            "saintbarthelemy" => Country::saint_barthelemy(),
3970            "saint_barthelemy" => Country::saint_barthelemy(),
3971            "652" => Country::saint_barthelemy(),
3972            "bl" => Country::saint_barthelemy(),
3973            "blm" => Country::saint_barthelemy(),
3974            "stbarthelemy" => Country::saint_barthelemy(),
3975            "saintkittsandnevis" => Country::saint_kitts_and_nevis(),
3976            "saint_kitts_and_nevis" => Country::saint_kitts_and_nevis(),
3977            "659" => Country::saint_kitts_and_nevis(),
3978            "kn" => Country::saint_kitts_and_nevis(),
3979            "kna" => Country::saint_kitts_and_nevis(),
3980            "stkitts" => Country::saint_kitts_and_nevis(),
3981            "saintlucia" => Country::saint_lucia(),
3982            "saint_lucia" => Country::saint_lucia(),
3983            "662" => Country::saint_lucia(),
3984            "lc" => Country::saint_lucia(),
3985            "lca" => Country::saint_lucia(),
3986            "stlucia" => Country::saint_lucia(),
3987            "saintpierreandmiquelon" => Country::saint_pierre_and_miquelon(),
3988            "saint_pierre_and_miquelon" => Country::saint_pierre_and_miquelon(),
3989            "666" => Country::saint_pierre_and_miquelon(),
3990            "pm" => Country::saint_pierre_and_miquelon(),
3991            "spm" => Country::saint_pierre_and_miquelon(),
3992            "stpierre" => Country::saint_pierre_and_miquelon(),
3993            "saintpierre" => Country::saint_pierre_and_miquelon(),
3994            "saintvincentandthegrenadines" => Country::saint_vincent_and_the_grenadines(),
3995            "saint_vincent_and_the_grenadines" => Country::saint_vincent_and_the_grenadines(),
3996            "670" => Country::saint_vincent_and_the_grenadines(),
3997            "vc" => Country::saint_vincent_and_the_grenadines(),
3998            "vct" => Country::saint_vincent_and_the_grenadines(),
3999            "stvincent" => Country::saint_vincent_and_the_grenadines(),
4000            "saintvincent" => Country::saint_vincent_and_the_grenadines(),
4001            "samoa" => Country::samoa(),
4002            "882" => Country::samoa(),
4003            "ws" => Country::samoa(),
4004            "wsm" => Country::samoa(),
4005            "sanmarino" => Country::san_marino(),
4006            "san_marino" => Country::san_marino(),
4007            "674" => Country::san_marino(),
4008            "sm" => Country::san_marino(),
4009            "smr" => Country::san_marino(),
4010            "saotomeandprincipe" => Country::sao_tome_and_principe(),
4011            "sao_tome_and_principe" => Country::sao_tome_and_principe(),
4012            "678" => Country::sao_tome_and_principe(),
4013            "st" => Country::sao_tome_and_principe(),
4014            "stp" => Country::sao_tome_and_principe(),
4015            "saotome" => Country::sao_tome_and_principe(),
4016            "saudiarabia" => Country::saudi_arabia(),
4017            "saudi_arabia" => Country::saudi_arabia(),
4018            "682" => Country::saudi_arabia(),
4019            "sa" => Country::saudi_arabia(),
4020            "sau" => Country::saudi_arabia(),
4021            "senegal" => Country::senegal(),
4022            "686" => Country::senegal(),
4023            "sn" => Country::senegal(),
4024            "sen" => Country::senegal(),
4025            "serbia" => Country::serbia(),
4026            "688" => Country::serbia(),
4027            "rs" => Country::serbia(),
4028            "srb" => Country::serbia(),
4029            "seychelles" => Country::seychelles(),
4030            "690" => Country::seychelles(),
4031            "sc" => Country::seychelles(),
4032            "syc" => Country::seychelles(),
4033            "sierraleone" => Country::sierra_leone(),
4034            "sierra_leone" => Country::sierra_leone(),
4035            "694" => Country::sierra_leone(),
4036            "sl" => Country::sierra_leone(),
4037            "sle" => Country::sierra_leone(),
4038            "singapore" => Country::singapore(),
4039            "702" => Country::singapore(),
4040            "sg" => Country::singapore(),
4041            "sgp" => Country::singapore(),
4042            "slovakia" => Country::slovakia(),
4043            "703" => Country::slovakia(),
4044            "sk" => Country::slovakia(),
4045            "svk" => Country::slovakia(),
4046            "slovenia" => Country::slovenia(),
4047            "705" => Country::slovenia(),
4048            "si" => Country::slovenia(),
4049            "svn" => Country::slovenia(),
4050            "solomonislands" => Country::solomon_islands(),
4051            "solomon_islands" => Country::solomon_islands(),
4052            "090" => Country::solomon_islands(),
4053            "sb" => Country::solomon_islands(),
4054            "slb" => Country::solomon_islands(),
4055            "somalia" => Country::somalia(),
4056            "706" => Country::somalia(),
4057            "so" => Country::somalia(),
4058            "som" => Country::somalia(),
4059            "southafrica" => Country::south_africa(),
4060            "south_africa" => Country::south_africa(),
4061            "710" => Country::south_africa(),
4062            "za" => Country::south_africa(),
4063            "zaf" => Country::south_africa(),
4064            "southgeorgiaandthesouthsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
4065            "south_georgia_and_the_south_sandwich_islands" => Country::south_georgia_and_the_south_sandwich_islands(),
4066            "239" => Country::south_georgia_and_the_south_sandwich_islands(),
4067            "gs" => Country::south_georgia_and_the_south_sandwich_islands(),
4068            "sgs" => Country::south_georgia_and_the_south_sandwich_islands(),
4069            "southgeorgia" => Country::south_georgia_and_the_south_sandwich_islands(),
4070            "southsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
4071            "southsudan" => Country::south_sudan(),
4072            "south_sudan" => Country::south_sudan(),
4073            "728" => Country::south_sudan(),
4074            "ss" => Country::south_sudan(),
4075            "ssd" => Country::south_sudan(),
4076            "spain" => Country::spain(),
4077            "724" => Country::spain(),
4078            "es" => Country::spain(),
4079            "esp" => Country::spain(),
4080            "srilanka" => Country::sri_lanka(),
4081            "sri_lanka" => Country::sri_lanka(),
4082            "144" => Country::sri_lanka(),
4083            "lk" => Country::sri_lanka(),
4084            "lka" => Country::sri_lanka(),
4085            "stateofpalestine" => Country::state_of_palestine(),
4086            "state_of_palestine" => Country::state_of_palestine(),
4087            "275" => Country::state_of_palestine(),
4088            "ps" => Country::state_of_palestine(),
4089            "pse" => Country::state_of_palestine(),
4090            "palestine" => Country::state_of_palestine(),
4091            "suriname" => Country::suriname(),
4092            "740" => Country::suriname(),
4093            "sr" => Country::suriname(),
4094            "sur" => Country::suriname(),
4095            "svalbardandjanmayen" => Country::svalbard_and_jan_mayen(),
4096            "svalbard_and_jan_mayen" => Country::svalbard_and_jan_mayen(),
4097            "744" => Country::svalbard_and_jan_mayen(),
4098            "sj" => Country::svalbard_and_jan_mayen(),
4099            "sjm" => Country::svalbard_and_jan_mayen(),
4100            "sweden" => Country::sweden(),
4101            "752" => Country::sweden(),
4102            "se" => Country::sweden(),
4103            "swe" => Country::sweden(),
4104            "switzerland" => Country::switzerland(),
4105            "756" => Country::switzerland(),
4106            "ch" => Country::switzerland(),
4107            "che" => Country::switzerland(),
4108            "syrianarabrepublic" => Country::syrian_arab_republic(),
4109            "syrian_arab_republic" => Country::syrian_arab_republic(),
4110            "760" => Country::syrian_arab_republic(),
4111            "sy" => Country::syrian_arab_republic(),
4112            "syr" => Country::syrian_arab_republic(),
4113            "syria" => Country::syrian_arab_republic(),
4114            "taiwan,republicofchina" => Country::taiwan(),
4115            "taiwan" => Country::taiwan(),
4116            "158" => Country::taiwan(),
4117            "tw" => Country::taiwan(),
4118            "twn" => Country::taiwan(),
4119            "tajikistan" => Country::tajikistan(),
4120            "762" => Country::tajikistan(),
4121            "tj" => Country::tajikistan(),
4122            "tjk" => Country::tajikistan(),
4123            "thailand" => Country::thailand(),
4124            "764" => Country::thailand(),
4125            "th" => Country::thailand(),
4126            "tha" => Country::thailand(),
4127            "thebahamas" => Country::the_bahamas(),
4128            "the_bahamas" => Country::the_bahamas(),
4129            "044" => Country::the_bahamas(),
4130            "bs" => Country::the_bahamas(),
4131            "bhs" => Country::the_bahamas(),
4132            "bahamas" => Country::the_bahamas(),
4133            "thecaymanislands" => Country::the_cayman_islands(),
4134            "the_cayman_islands" => Country::the_cayman_islands(),
4135            "136" => Country::the_cayman_islands(),
4136            "ky" => Country::the_cayman_islands(),
4137            "cym" => Country::the_cayman_islands(),
4138            "caymanislands" => Country::the_cayman_islands(),
4139            "thecentralafricanrepublic" => Country::the_central_african_republic(),
4140            "the_central_african_republic" => Country::the_central_african_republic(),
4141            "140" => Country::the_central_african_republic(),
4142            "cf" => Country::the_central_african_republic(),
4143            "caf" => Country::the_central_african_republic(),
4144            "centralafricanrepublic" => Country::the_central_african_republic(),
4145            "thecocoskeelingislands" => Country::the_cocos_keeling_islands(),
4146            "the_cocos_keeling_islands" => Country::the_cocos_keeling_islands(),
4147            "166" => Country::the_cocos_keeling_islands(),
4148            "cc" => Country::the_cocos_keeling_islands(),
4149            "cck" => Country::the_cocos_keeling_islands(),
4150            "cocosislands" => Country::the_cocos_keeling_islands(),
4151            "keelingislands" => Country::the_cocos_keeling_islands(),
4152            "thecomoros" => Country::the_comoros(),
4153            "the_comoros" => Country::the_comoros(),
4154            "174" => Country::the_comoros(),
4155            "km" => Country::the_comoros(),
4156            "com" => Country::the_comoros(),
4157            "comoros" => Country::the_comoros(),
4158            "thecongo" => Country::the_congo(),
4159            "the_congo" => Country::the_congo(),
4160            "178" => Country::the_congo(),
4161            "cg" => Country::the_congo(),
4162            "cog" => Country::the_congo(),
4163            "congo" => Country::the_congo(),
4164            "thecookislands" => Country::the_cook_islands(),
4165            "the_cook_islands" => Country::the_cook_islands(),
4166            "184" => Country::the_cook_islands(),
4167            "ck" => Country::the_cook_islands(),
4168            "cok" => Country::the_cook_islands(),
4169            "cookislands" => Country::the_cook_islands(),
4170            "thedemocraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
4171            "the_democratic_peoples_republic_of_korea" => Country::the_democratic_peoples_republic_of_korea(),
4172            "408" => Country::the_democratic_peoples_republic_of_korea(),
4173            "kp" => Country::the_democratic_peoples_republic_of_korea(),
4174            "prk" => Country::the_democratic_peoples_republic_of_korea(),
4175            "northkorea" => Country::the_democratic_peoples_republic_of_korea(),
4176            "democraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
4177            "thedemocraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
4178            "the_democratic_republic_of_the_congo" => Country::the_democratic_republic_of_the_congo(),
4179            "180" => Country::the_democratic_republic_of_the_congo(),
4180            "cd" => Country::the_democratic_republic_of_the_congo(),
4181            "cod" => Country::the_democratic_republic_of_the_congo(),
4182            "democraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
4183            "thedominicanrepublic" => Country::the_dominican_republic(),
4184            "the_dominican_republic" => Country::the_dominican_republic(),
4185            "214" => Country::the_dominican_republic(),
4186            "do" => Country::the_dominican_republic(),
4187            "dom" => Country::the_dominican_republic(),
4188            "dominicanrepublic" => Country::the_dominican_republic(),
4189            "thefalklandislandsmalvinas" => Country::the_falkland_islands_malvinas(),
4190            "the_falkland_islands_malvinas" => Country::the_falkland_islands_malvinas(),
4191            "238" => Country::the_falkland_islands_malvinas(),
4192            "fk" => Country::the_falkland_islands_malvinas(),
4193            "flk" => Country::the_falkland_islands_malvinas(),
4194            "malvinas" => Country::the_falkland_islands_malvinas(),
4195            "falklandislands" => Country::the_falkland_islands_malvinas(),
4196            "thefaroeislands" => Country::the_faroe_islands(),
4197            "the_faroe_islands" => Country::the_faroe_islands(),
4198            "234" => Country::the_faroe_islands(),
4199            "fo" => Country::the_faroe_islands(),
4200            "fro" => Country::the_faroe_islands(),
4201            "faroeislands" => Country::the_faroe_islands(),
4202            "thefrenchsouthernterritories" => Country::the_french_southern_territories(),
4203            "the_french_southern_territories" => Country::the_french_southern_territories(),
4204            "260" => Country::the_french_southern_territories(),
4205            "tf" => Country::the_french_southern_territories(),
4206            "atf" => Country::the_french_southern_territories(),
4207            "frenchsouthernterritories" => Country::the_french_southern_territories(),
4208            "thegambia" => Country::the_gambia(),
4209            "the_gambia" => Country::the_gambia(),
4210            "270" => Country::the_gambia(),
4211            "gm" => Country::the_gambia(),
4212            "gmb" => Country::the_gambia(),
4213            "gambia" => Country::the_gambia(),
4214            "theholysee" => Country::the_holy_see(),
4215            "the_holy_see" => Country::the_holy_see(),
4216            "336" => Country::the_holy_see(),
4217            "va" => Country::the_holy_see(),
4218            "vat" => Country::the_holy_see(),
4219            "holysee" => Country::the_holy_see(),
4220            "vatican" => Country::the_holy_see(),
4221            "vaticancity" => Country::the_holy_see(),
4222            "vatican_city" => Country::the_holy_see(),
4223            "thelaopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
4224            "the_lao_peoples_democratic_republic" => Country::the_lao_peoples_democratic_republic(),
4225            "418" => Country::the_lao_peoples_democratic_republic(),
4226            "la" => Country::the_lao_peoples_democratic_republic(),
4227            "lao" => Country::the_lao_peoples_democratic_republic(),
4228            "laopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
4229            "laos" => Country::the_lao_peoples_democratic_republic(),
4230            "themarshallislands" => Country::the_marshall_islands(),
4231            "the_marshall_islands" => Country::the_marshall_islands(),
4232            "584" => Country::the_marshall_islands(),
4233            "mh" => Country::the_marshall_islands(),
4234            "mhl" => Country::the_marshall_islands(),
4235            "marshallislands" => Country::the_marshall_islands(),
4236            "thenetherlands" => Country::the_netherlands(),
4237            "the_netherlands" => Country::the_netherlands(),
4238            "528" => Country::the_netherlands(),
4239            "nl" => Country::the_netherlands(),
4240            "nld" => Country::the_netherlands(),
4241            "netherlands" => Country::the_netherlands(),
4242            "holland" => Country::the_netherlands(),
4243            "theniger" => Country::the_niger(),
4244            "the_niger" => Country::the_niger(),
4245            "562" => Country::the_niger(),
4246            "ne" => Country::the_niger(),
4247            "ner" => Country::the_niger(),
4248            "niger" => Country::the_niger(),
4249            "thenorthernmarianaislands" => Country::the_northern_mariana_islands(),
4250            "the_northern_mariana_islands" => Country::the_northern_mariana_islands(),
4251            "580" => Country::the_northern_mariana_islands(),
4252            "mp" => Country::the_northern_mariana_islands(),
4253            "mnp" => Country::the_northern_mariana_islands(),
4254            "northernmarianaislands" => Country::the_northern_mariana_islands(),
4255            "thephilippines" => Country::the_philippines(),
4256            "the_philippines" => Country::the_philippines(),
4257            "608" => Country::the_philippines(),
4258            "ph" => Country::the_philippines(),
4259            "phl" => Country::the_philippines(),
4260            "philippines" => Country::the_philippines(),
4261            "therepublicofkorea" => Country::the_republic_of_korea(),
4262            "the_republic_of_korea" => Country::the_republic_of_korea(),
4263            "410" => Country::the_republic_of_korea(),
4264            "kr" => Country::the_republic_of_korea(),
4265            "kor" => Country::the_republic_of_korea(),
4266            "southkorea" => Country::the_republic_of_korea(),
4267            "republicofkorea" => Country::the_republic_of_korea(),
4268            "therepublicofmoldova" => Country::the_republic_of_moldova(),
4269            "the_republic_of_moldova" => Country::the_republic_of_moldova(),
4270            "498" => Country::the_republic_of_moldova(),
4271            "md" => Country::the_republic_of_moldova(),
4272            "mda" => Country::the_republic_of_moldova(),
4273            "moldova" => Country::the_republic_of_moldova(),
4274            "republicofmoldova" => Country::the_republic_of_moldova(),
4275            "therussianfederation" => Country::the_russian_federation(),
4276            "the_russian_federation" => Country::the_russian_federation(),
4277            "643" => Country::the_russian_federation(),
4278            "ru" => Country::the_russian_federation(),
4279            "rus" => Country::the_russian_federation(),
4280            "russia" => Country::the_russian_federation(),
4281            "russianfederation" => Country::the_russian_federation(),
4282            "thesudan" => Country::the_sudan(),
4283            "the_sudan" => Country::the_sudan(),
4284            "729" => Country::the_sudan(),
4285            "sd" => Country::the_sudan(),
4286            "sdn" => Country::the_sudan(),
4287            "sudan" => Country::the_sudan(),
4288            "theturksandcaicosislands" => Country::the_turks_and_caicos_islands(),
4289            "the_turks_and_caicos_islands" => Country::the_turks_and_caicos_islands(),
4290            "796" => Country::the_turks_and_caicos_islands(),
4291            "tc" => Country::the_turks_and_caicos_islands(),
4292            "tca" => Country::the_turks_and_caicos_islands(),
4293            "turksandcaicosislands" => Country::the_turks_and_caicos_islands(),
4294            "theunitedarabemirates" => Country::the_united_arab_emirates(),
4295            "the_united_arab_emirates" => Country::the_united_arab_emirates(),
4296            "784" => Country::the_united_arab_emirates(),
4297            "ae" => Country::the_united_arab_emirates(),
4298            "are" => Country::the_united_arab_emirates(),
4299            "unitedarabemirates" => Country::the_united_arab_emirates(),
4300            "theunitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4301            "the_united_kingdom_of_great_britain_and_northern_ireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4302            "826" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4303            "gb" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4304            "gbr" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4305            "england" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4306            "scotland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4307            "greatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4308            "unitedkingdom" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4309            "northernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4310            "unitedkingdomofgreatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4311            "unitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4312            "theunitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
4313            "the_united_states_minor_outlying_islands" => Country::the_united_states_minor_outlying_islands(),
4314            "581" => Country::the_united_states_minor_outlying_islands(),
4315            "um" => Country::the_united_states_minor_outlying_islands(),
4316            "umi" => Country::the_united_states_minor_outlying_islands(),
4317            "unitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
4318            "theunitedstatesofamerica" => Country::the_united_states_of_america(),
4319            "the_united_states_of_america" => Country::the_united_states_of_america(),
4320            "840" => Country::the_united_states_of_america(),
4321            "us" => Country::the_united_states_of_america(),
4322            "usa" => Country::the_united_states_of_america(),
4323            "america" => Country::the_united_states_of_america(),
4324            "united states" => Country::the_united_states_of_america(),
4325            "unitedstates" => Country::the_united_states_of_america(),
4326            "unitedstatesofamerica" => Country::the_united_states_of_america(),
4327            "united_states_of_america" => Country::the_united_states_of_america(),
4328            "timorleste" => Country::timor_leste(),
4329            "timor_leste" => Country::timor_leste(),
4330            "626" => Country::timor_leste(),
4331            "tl" => Country::timor_leste(),
4332            "tls" => Country::timor_leste(),
4333            "togo" => Country::togo(),
4334            "768" => Country::togo(),
4335            "tg" => Country::togo(),
4336            "tgo" => Country::togo(),
4337            "tokelau" => Country::tokelau(),
4338            "772" => Country::tokelau(),
4339            "tk" => Country::tokelau(),
4340            "tkl" => Country::tokelau(),
4341            "tonga" => Country::tonga(),
4342            "776" => Country::tonga(),
4343            "to" => Country::tonga(),
4344            "ton" => Country::tonga(),
4345            "trinidadandtobago" => Country::trinidad_and_tobago(),
4346            "trinidad_and_tobago" => Country::trinidad_and_tobago(),
4347            "780" => Country::trinidad_and_tobago(),
4348            "tt" => Country::trinidad_and_tobago(),
4349            "tto" => Country::trinidad_and_tobago(),
4350            "trinidad" => Country::trinidad_and_tobago(),
4351            "tobago" => Country::trinidad_and_tobago(),
4352            "tunisia" => Country::tunisia(),
4353            "788" => Country::tunisia(),
4354            "tn" => Country::tunisia(),
4355            "tun" => Country::tunisia(),
4356            "turkey" => Country::turkey(),
4357            "türkiye" => Country::turkey(),
4358            "792" => Country::turkey(),
4359            "tr" => Country::turkey(),
4360            "tur" => Country::turkey(),
4361            "turkmenistan" => Country::turkmenistan(),
4362            "795" => Country::turkmenistan(),
4363            "tm" => Country::turkmenistan(),
4364            "tkm" => Country::turkmenistan(),
4365            "tuvalu" => Country::tuvalu(),
4366            "798" => Country::tuvalu(),
4367            "tv" => Country::tuvalu(),
4368            "tuv" => Country::tuvalu(),
4369            "usvirginislands" => Country::us_virgin_islands(),
4370            "us_virgin_islands" => Country::us_virgin_islands(),
4371            "850" => Country::us_virgin_islands(),
4372            "vi" => Country::us_virgin_islands(),
4373            "vir" => Country::us_virgin_islands(),
4374            "uganda" => Country::uganda(),
4375            "800" => Country::uganda(),
4376            "ug" => Country::uganda(),
4377            "uga" => Country::uganda(),
4378            "ukraine" => Country::ukraine(),
4379            "804" => Country::ukraine(),
4380            "ua" => Country::ukraine(),
4381            "ukr" => Country::ukraine(),
4382            "unitedrepublicoftanzania" => Country::united_republic_of_tanzania(),
4383            "united_republic_of_tanzania" => Country::united_republic_of_tanzania(),
4384            "834" => Country::united_republic_of_tanzania(),
4385            "tz" => Country::united_republic_of_tanzania(),
4386            "tza" => Country::united_republic_of_tanzania(),
4387            "tanzania" => Country::united_republic_of_tanzania(),
4388            "uruguay" => Country::uruguay(),
4389            "858" => Country::uruguay(),
4390            "uy" => Country::uruguay(),
4391            "ury" => Country::uruguay(),
4392            "uzbekistan" => Country::uzbekistan(),
4393            "860" => Country::uzbekistan(),
4394            "uz" => Country::uzbekistan(),
4395            "uzb" => Country::uzbekistan(),
4396            "vanuatu" => Country::vanuatu(),
4397            "548" => Country::vanuatu(),
4398            "vu" => Country::vanuatu(),
4399            "vut" => Country::vanuatu(),
4400            "vietnam" => Country::vietnam(),
4401            "704" => Country::vietnam(),
4402            "vn" => Country::vietnam(),
4403            "vnm" => Country::vietnam(),
4404            "wallisandfutuna" => Country::wallis_and_futuna(),
4405            "wallis_and_futuna" => Country::wallis_and_futuna(),
4406            "876" => Country::wallis_and_futuna(),
4407            "wf" => Country::wallis_and_futuna(),
4408            "wlf" => Country::wallis_and_futuna(),
4409            "westernsahara" => Country::western_sahara(),
4410            "western_sahara" => Country::western_sahara(),
4411            "732" => Country::western_sahara(),
4412            "eh" => Country::western_sahara(),
4413            "esh" => Country::western_sahara(),
4414            "yemen" => Country::yemen(),
4415            "887" => Country::yemen(),
4416            "ye" => Country::yemen(),
4417            "yem" => Country::yemen(),
4418            "zambia" => Country::zambia(),
4419            "894" => Country::zambia(),
4420            "zm" => Country::zambia(),
4421            "zmb" => Country::zambia(),
4422            "zimbabwe" => Country::zimbabwe(),
4423            "716" => Country::zimbabwe(),
4424            "zw" => Country::zimbabwe(),
4425            "zwe" => Country::zimbabwe(),
4426        };
4427        lookup_ascii_lowercase(&CODES, code)
4428            .copied()
4429            .ok_or("unknown value")
4430    }
4431}