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        turkiye,
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    /// Creates a struct for Türkiye
1409    #[deprecated(
1410        since = "2.8.0",
1411        note = "Turkey was renamed to Türkiye in 2022. Use Country::turkiye() instead."
1412    )]
1413    #[inline]
1414    #[must_use]
1415    pub const fn turkey() -> Self {
1416        Self::turkiye()
1417    }
1418
1419    /// Returns a vector in alphabetic order of all the countries
1420    ///
1421    /// ```
1422    /// use celes::Country;
1423    /// use std::collections::BTreeMap;
1424    ///
1425    /// let countries = Country::get_countries();
1426    ///
1427    ///
1428    /// for c in &countries {
1429    ///     println!("{}", c);
1430    /// }
1431    ///
1432    /// for c in &countries {
1433    ///     println!("{}", c.alpha2);
1434    /// }
1435    ///
1436    /// for c in countries.iter().filter(|cty| cty.value < 300) {
1437    ///     println!("{}", c.long_name)
1438    /// }
1439    ///
1440    /// //Convert to a map
1441    /// let lookup = countries.iter().map(|cty| (cty.alpha2.to_string(), cty.clone())).collect::<BTreeMap<String, Country>>();
1442    ///
1443    /// ```
1444    #[must_use]
1445    #[allow(clippy::too_many_lines, clippy::large_stack_arrays)]
1446    pub const fn get_countries() -> [Self; 250] {
1447        [
1448            Self::afghanistan(),
1449            Self::aland_islands(),
1450            Self::albania(),
1451            Self::algeria(),
1452            Self::american_samoa(),
1453            Self::andorra(),
1454            Self::angola(),
1455            Self::anguilla(),
1456            Self::antarctica(),
1457            Self::antigua_and_barbuda(),
1458            Self::argentina(),
1459            Self::armenia(),
1460            Self::aruba(),
1461            Self::ascension_and_tristan_da_cunha_saint_helena(),
1462            Self::australia(),
1463            Self::austria(),
1464            Self::azerbaijan(),
1465            Self::bahrain(),
1466            Self::bangladesh(),
1467            Self::barbados(),
1468            Self::belarus(),
1469            Self::belgium(),
1470            Self::belize(),
1471            Self::benin(),
1472            Self::bermuda(),
1473            Self::bhutan(),
1474            Self::bolivarian_republic_of_venezuela(),
1475            Self::bolivia(),
1476            Self::bonaire(),
1477            Self::bosnia_and_herzegovina(),
1478            Self::botswana(),
1479            Self::bouvet_island(),
1480            Self::brazil(),
1481            Self::british_indian_ocean_territory(),
1482            Self::british_virgin_islands(),
1483            Self::brunei_darussalam(),
1484            Self::bulgaria(),
1485            Self::burkina_faso(),
1486            Self::burundi(),
1487            Self::cabo_verde(),
1488            Self::cambodia(),
1489            Self::cameroon(),
1490            Self::canada(),
1491            Self::chad(),
1492            Self::chile(),
1493            Self::china(),
1494            Self::christmas_island(),
1495            Self::colombia(),
1496            Self::costa_rica(),
1497            Self::coted_ivoire(),
1498            Self::croatia(),
1499            Self::cuba(),
1500            Self::curacao(),
1501            Self::cyprus(),
1502            Self::czechia(),
1503            Self::denmark(),
1504            Self::djibouti(),
1505            Self::dominica(),
1506            Self::dutch_part_sint_maarten(),
1507            Self::ecuador(),
1508            Self::egypt(),
1509            Self::el_salvador(),
1510            Self::equatorial_guinea(),
1511            Self::eritrea(),
1512            Self::estonia(),
1513            Self::eswatini(),
1514            Self::ethiopia(),
1515            Self::federated_states_of_micronesia(),
1516            Self::fiji(),
1517            Self::finland(),
1518            Self::france(),
1519            Self::french_guiana(),
1520            Self::french_part_saint_martin(),
1521            Self::french_polynesia(),
1522            Self::gabon(),
1523            Self::georgia(),
1524            Self::germany(),
1525            Self::ghana(),
1526            Self::gibraltar(),
1527            Self::greece(),
1528            Self::greenland(),
1529            Self::grenada(),
1530            Self::guadeloupe(),
1531            Self::guam(),
1532            Self::guatemala(),
1533            Self::guernsey(),
1534            Self::guinea(),
1535            Self::guinea_bissau(),
1536            Self::guyana(),
1537            Self::haiti(),
1538            Self::heard_island_and_mc_donald_islands(),
1539            Self::honduras(),
1540            Self::hong_kong(),
1541            Self::hungary(),
1542            Self::iceland(),
1543            Self::india(),
1544            Self::indonesia(),
1545            Self::iraq(),
1546            Self::ireland(),
1547            Self::islamic_republic_of_iran(),
1548            Self::isle_of_man(),
1549            Self::israel(),
1550            Self::italy(),
1551            Self::jamaica(),
1552            Self::japan(),
1553            Self::jersey(),
1554            Self::jordan(),
1555            Self::kazakhstan(),
1556            Self::kenya(),
1557            Self::kiribati(),
1558            Self::kosovo(),
1559            Self::kuwait(),
1560            Self::kyrgyzstan(),
1561            Self::latvia(),
1562            Self::lebanon(),
1563            Self::lesotho(),
1564            Self::liberia(),
1565            Self::libya(),
1566            Self::liechtenstein(),
1567            Self::lithuania(),
1568            Self::luxembourg(),
1569            Self::macao(),
1570            Self::madagascar(),
1571            Self::malawi(),
1572            Self::malaysia(),
1573            Self::maldives(),
1574            Self::mali(),
1575            Self::malta(),
1576            Self::martinique(),
1577            Self::mauritania(),
1578            Self::mauritius(),
1579            Self::mayotte(),
1580            Self::mexico(),
1581            Self::monaco(),
1582            Self::mongolia(),
1583            Self::montenegro(),
1584            Self::montserrat(),
1585            Self::morocco(),
1586            Self::mozambique(),
1587            Self::myanmar(),
1588            Self::namibia(),
1589            Self::nauru(),
1590            Self::nepal(),
1591            Self::new_caledonia(),
1592            Self::new_zealand(),
1593            Self::nicaragua(),
1594            Self::nigeria(),
1595            Self::niue(),
1596            Self::norfolk_island(),
1597            Self::norway(),
1598            Self::oman(),
1599            Self::pakistan(),
1600            Self::palau(),
1601            Self::panama(),
1602            Self::papua_new_guinea(),
1603            Self::paraguay(),
1604            Self::peru(),
1605            Self::pitcairn(),
1606            Self::poland(),
1607            Self::portugal(),
1608            Self::puerto_rico(),
1609            Self::qatar(),
1610            Self::republic_of_north_macedonia(),
1611            Self::reunion(),
1612            Self::romania(),
1613            Self::rwanda(),
1614            Self::saint_barthelemy(),
1615            Self::saint_kitts_and_nevis(),
1616            Self::saint_lucia(),
1617            Self::saint_pierre_and_miquelon(),
1618            Self::saint_vincent_and_the_grenadines(),
1619            Self::samoa(),
1620            Self::san_marino(),
1621            Self::sao_tome_and_principe(),
1622            Self::saudi_arabia(),
1623            Self::senegal(),
1624            Self::serbia(),
1625            Self::seychelles(),
1626            Self::sierra_leone(),
1627            Self::singapore(),
1628            Self::slovakia(),
1629            Self::slovenia(),
1630            Self::solomon_islands(),
1631            Self::somalia(),
1632            Self::south_africa(),
1633            Self::south_georgia_and_the_south_sandwich_islands(),
1634            Self::south_sudan(),
1635            Self::spain(),
1636            Self::sri_lanka(),
1637            Self::state_of_palestine(),
1638            Self::suriname(),
1639            Self::svalbard_and_jan_mayen(),
1640            Self::sweden(),
1641            Self::switzerland(),
1642            Self::syrian_arab_republic(),
1643            Self::taiwan(),
1644            Self::tajikistan(),
1645            Self::thailand(),
1646            Self::the_bahamas(),
1647            Self::the_cayman_islands(),
1648            Self::the_central_african_republic(),
1649            Self::the_cocos_keeling_islands(),
1650            Self::the_comoros(),
1651            Self::the_congo(),
1652            Self::the_cook_islands(),
1653            Self::the_democratic_peoples_republic_of_korea(),
1654            Self::the_democratic_republic_of_the_congo(),
1655            Self::the_dominican_republic(),
1656            Self::the_falkland_islands_malvinas(),
1657            Self::the_faroe_islands(),
1658            Self::the_french_southern_territories(),
1659            Self::the_gambia(),
1660            Self::the_holy_see(),
1661            Self::the_lao_peoples_democratic_republic(),
1662            Self::the_marshall_islands(),
1663            Self::the_netherlands(),
1664            Self::the_niger(),
1665            Self::the_northern_mariana_islands(),
1666            Self::the_philippines(),
1667            Self::the_republic_of_korea(),
1668            Self::the_republic_of_moldova(),
1669            Self::the_russian_federation(),
1670            Self::the_sudan(),
1671            Self::the_turks_and_caicos_islands(),
1672            Self::the_united_arab_emirates(),
1673            Self::the_united_kingdom_of_great_britain_and_northern_ireland(),
1674            Self::the_united_states_minor_outlying_islands(),
1675            Self::the_united_states_of_america(),
1676            Self::timor_leste(),
1677            Self::togo(),
1678            Self::tokelau(),
1679            Self::tonga(),
1680            Self::trinidad_and_tobago(),
1681            Self::tunisia(),
1682            Self::turkiye(),
1683            Self::turkmenistan(),
1684            Self::tuvalu(),
1685            Self::us_virgin_islands(),
1686            Self::uganda(),
1687            Self::ukraine(),
1688            Self::united_republic_of_tanzania(),
1689            Self::uruguay(),
1690            Self::uzbekistan(),
1691            Self::vanuatu(),
1692            Self::vietnam(),
1693            Self::wallis_and_futuna(),
1694            Self::western_sahara(),
1695            Self::yemen(),
1696            Self::zambia(),
1697            Self::zimbabwe(),
1698        ]
1699    }
1700
1701    /// Given the numeric code, return a country or an error if
1702    /// the parameter doesn't match any country
1703    ///
1704    /// # Errors
1705    ///
1706    /// Returns an error if the value does not match any known country code.
1707    ///
1708    /// ```
1709    /// use celes::Country;
1710    ///
1711    /// let res = Country::from_value(1);
1712    /// assert!(res.is_err());
1713    ///
1714    /// let res = Country::from_value(2);
1715    /// assert!(res.is_err());
1716    ///
1717    /// let res = Country::from_value(4);
1718    /// assert!(res.is_ok());
1719    ///
1720    /// assert_eq!(Country::afghanistan(), res.unwrap());
1721    /// ```
1722    #[allow(clippy::too_many_lines)]
1723    pub fn from_value(value: usize) -> Result<Self, &'static str> {
1724        static VALUES: Map<usize, Country> = phf_map! {
1725            4usize => Country::afghanistan(),
1726            248usize => Country::aland_islands(),
1727            8usize => Country::albania(),
1728            12usize => Country::algeria(),
1729            16usize => Country::american_samoa(),
1730            20usize => Country::andorra(),
1731            24usize => Country::angola(),
1732            660usize => Country::anguilla(),
1733            10usize => Country::antarctica(),
1734            28usize => Country::antigua_and_barbuda(),
1735            32usize => Country::argentina(),
1736            51usize => Country::armenia(),
1737            533usize => Country::aruba(),
1738            654usize => Country::ascension_and_tristan_da_cunha_saint_helena(),
1739            36usize => Country::australia(),
1740            40usize => Country::austria(),
1741            31usize => Country::azerbaijan(),
1742            48usize => Country::bahrain(),
1743            50usize => Country::bangladesh(),
1744            52usize => Country::barbados(),
1745            112usize => Country::belarus(),
1746            56usize => Country::belgium(),
1747            84usize => Country::belize(),
1748            204usize => Country::benin(),
1749            60usize => Country::bermuda(),
1750            64usize => Country::bhutan(),
1751            862usize => Country::bolivarian_republic_of_venezuela(),
1752            68usize => Country::bolivia(),
1753            535usize => Country::bonaire(),
1754            70usize => Country::bosnia_and_herzegovina(),
1755            72usize => Country::botswana(),
1756            74usize => Country::bouvet_island(),
1757            76usize => Country::brazil(),
1758            86usize => Country::british_indian_ocean_territory(),
1759            92usize => Country::british_virgin_islands(),
1760            96usize => Country::brunei_darussalam(),
1761            100usize => Country::bulgaria(),
1762            854usize => Country::burkina_faso(),
1763            108usize => Country::burundi(),
1764            132usize => Country::cabo_verde(),
1765            116usize => Country::cambodia(),
1766            120usize => Country::cameroon(),
1767            124usize => Country::canada(),
1768            148usize => Country::chad(),
1769            152usize => Country::chile(),
1770            156usize => Country::china(),
1771            162usize => Country::christmas_island(),
1772            170usize => Country::colombia(),
1773            188usize => Country::costa_rica(),
1774            384usize => Country::coted_ivoire(),
1775            191usize => Country::croatia(),
1776            192usize => Country::cuba(),
1777            531usize => Country::curacao(),
1778            196usize => Country::cyprus(),
1779            203usize => Country::czechia(),
1780            208usize => Country::denmark(),
1781            262usize => Country::djibouti(),
1782            212usize => Country::dominica(),
1783            534usize => Country::dutch_part_sint_maarten(),
1784            218usize => Country::ecuador(),
1785            818usize => Country::egypt(),
1786            222usize => Country::el_salvador(),
1787            226usize => Country::equatorial_guinea(),
1788            232usize => Country::eritrea(),
1789            233usize => Country::estonia(),
1790            748usize => Country::eswatini(),
1791            231usize => Country::ethiopia(),
1792            583usize => Country::federated_states_of_micronesia(),
1793            242usize => Country::fiji(),
1794            246usize => Country::finland(),
1795            250usize => Country::france(),
1796            254usize => Country::french_guiana(),
1797            663usize => Country::french_part_saint_martin(),
1798            258usize => Country::french_polynesia(),
1799            266usize => Country::gabon(),
1800            268usize => Country::georgia(),
1801            276usize => Country::germany(),
1802            288usize => Country::ghana(),
1803            292usize => Country::gibraltar(),
1804            300usize => Country::greece(),
1805            304usize => Country::greenland(),
1806            308usize => Country::grenada(),
1807            312usize => Country::guadeloupe(),
1808            316usize => Country::guam(),
1809            320usize => Country::guatemala(),
1810            831usize => Country::guernsey(),
1811            324usize => Country::guinea(),
1812            624usize => Country::guinea_bissau(),
1813            328usize => Country::guyana(),
1814            332usize => Country::haiti(),
1815            334usize => Country::heard_island_and_mc_donald_islands(),
1816            340usize => Country::honduras(),
1817            344usize => Country::hong_kong(),
1818            348usize => Country::hungary(),
1819            352usize => Country::iceland(),
1820            356usize => Country::india(),
1821            360usize => Country::indonesia(),
1822            368usize => Country::iraq(),
1823            372usize => Country::ireland(),
1824            364usize => Country::islamic_republic_of_iran(),
1825            833usize => Country::isle_of_man(),
1826            376usize => Country::israel(),
1827            380usize => Country::italy(),
1828            388usize => Country::jamaica(),
1829            392usize => Country::japan(),
1830            832usize => Country::jersey(),
1831            400usize => Country::jordan(),
1832            398usize => Country::kazakhstan(),
1833            404usize => Country::kenya(),
1834            296usize => Country::kiribati(),
1835            383usize => Country::kosovo(),
1836            414usize => Country::kuwait(),
1837            417usize => Country::kyrgyzstan(),
1838            428usize => Country::latvia(),
1839            422usize => Country::lebanon(),
1840            426usize => Country::lesotho(),
1841            430usize => Country::liberia(),
1842            434usize => Country::libya(),
1843            438usize => Country::liechtenstein(),
1844            440usize => Country::lithuania(),
1845            442usize => Country::luxembourg(),
1846            446usize => Country::macao(),
1847            450usize => Country::madagascar(),
1848            454usize => Country::malawi(),
1849            458usize => Country::malaysia(),
1850            462usize => Country::maldives(),
1851            466usize => Country::mali(),
1852            470usize => Country::malta(),
1853            474usize => Country::martinique(),
1854            478usize => Country::mauritania(),
1855            480usize => Country::mauritius(),
1856            175usize => Country::mayotte(),
1857            484usize => Country::mexico(),
1858            492usize => Country::monaco(),
1859            496usize => Country::mongolia(),
1860            499usize => Country::montenegro(),
1861            500usize => Country::montserrat(),
1862            504usize => Country::morocco(),
1863            508usize => Country::mozambique(),
1864            104usize => Country::myanmar(),
1865            516usize => Country::namibia(),
1866            520usize => Country::nauru(),
1867            524usize => Country::nepal(),
1868            540usize => Country::new_caledonia(),
1869            554usize => Country::new_zealand(),
1870            558usize => Country::nicaragua(),
1871            566usize => Country::nigeria(),
1872            570usize => Country::niue(),
1873            574usize => Country::norfolk_island(),
1874            578usize => Country::norway(),
1875            512usize => Country::oman(),
1876            586usize => Country::pakistan(),
1877            585usize => Country::palau(),
1878            591usize => Country::panama(),
1879            598usize => Country::papua_new_guinea(),
1880            600usize => Country::paraguay(),
1881            604usize => Country::peru(),
1882            612usize => Country::pitcairn(),
1883            616usize => Country::poland(),
1884            620usize => Country::portugal(),
1885            630usize => Country::puerto_rico(),
1886            634usize => Country::qatar(),
1887            807usize => Country::republic_of_north_macedonia(),
1888            638usize => Country::reunion(),
1889            642usize => Country::romania(),
1890            646usize => Country::rwanda(),
1891            652usize => Country::saint_barthelemy(),
1892            659usize => Country::saint_kitts_and_nevis(),
1893            662usize => Country::saint_lucia(),
1894            666usize => Country::saint_pierre_and_miquelon(),
1895            670usize => Country::saint_vincent_and_the_grenadines(),
1896            882usize => Country::samoa(),
1897            674usize => Country::san_marino(),
1898            678usize => Country::sao_tome_and_principe(),
1899            682usize => Country::saudi_arabia(),
1900            686usize => Country::senegal(),
1901            688usize => Country::serbia(),
1902            690usize => Country::seychelles(),
1903            694usize => Country::sierra_leone(),
1904            702usize => Country::singapore(),
1905            703usize => Country::slovakia(),
1906            705usize => Country::slovenia(),
1907            90usize => Country::solomon_islands(),
1908            706usize => Country::somalia(),
1909            710usize => Country::south_africa(),
1910            239usize => Country::south_georgia_and_the_south_sandwich_islands(),
1911            728usize => Country::south_sudan(),
1912            724usize => Country::spain(),
1913            144usize => Country::sri_lanka(),
1914            275usize => Country::state_of_palestine(),
1915            740usize => Country::suriname(),
1916            744usize => Country::svalbard_and_jan_mayen(),
1917            752usize => Country::sweden(),
1918            756usize => Country::switzerland(),
1919            760usize => Country::syrian_arab_republic(),
1920            158usize => Country::taiwan(),
1921            762usize => Country::tajikistan(),
1922            764usize => Country::thailand(),
1923            44usize => Country::the_bahamas(),
1924            136usize => Country::the_cayman_islands(),
1925            140usize => Country::the_central_african_republic(),
1926            166usize => Country::the_cocos_keeling_islands(),
1927            174usize => Country::the_comoros(),
1928            178usize => Country::the_congo(),
1929            184usize => Country::the_cook_islands(),
1930            408usize => Country::the_democratic_peoples_republic_of_korea(),
1931            180usize => Country::the_democratic_republic_of_the_congo(),
1932            214usize => Country::the_dominican_republic(),
1933            238usize => Country::the_falkland_islands_malvinas(),
1934            234usize => Country::the_faroe_islands(),
1935            260usize => Country::the_french_southern_territories(),
1936            270usize => Country::the_gambia(),
1937            336usize => Country::the_holy_see(),
1938            418usize => Country::the_lao_peoples_democratic_republic(),
1939            584usize => Country::the_marshall_islands(),
1940            528usize => Country::the_netherlands(),
1941            562usize => Country::the_niger(),
1942            580usize => Country::the_northern_mariana_islands(),
1943            608usize => Country::the_philippines(),
1944            410usize => Country::the_republic_of_korea(),
1945            498usize => Country::the_republic_of_moldova(),
1946            643usize => Country::the_russian_federation(),
1947            729usize => Country::the_sudan(),
1948            796usize => Country::the_turks_and_caicos_islands(),
1949            784usize => Country::the_united_arab_emirates(),
1950            826usize => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
1951            581usize => Country::the_united_states_minor_outlying_islands(),
1952            840usize => Country::the_united_states_of_america(),
1953            626usize => Country::timor_leste(),
1954            768usize => Country::togo(),
1955            772usize => Country::tokelau(),
1956            776usize => Country::tonga(),
1957            780usize => Country::trinidad_and_tobago(),
1958            788usize => Country::tunisia(),
1959            792usize => Country::turkiye(),
1960            795usize => Country::turkmenistan(),
1961            798usize => Country::tuvalu(),
1962            850usize => Country::us_virgin_islands(),
1963            800usize => Country::uganda(),
1964            804usize => Country::ukraine(),
1965            834usize => Country::united_republic_of_tanzania(),
1966            858usize => Country::uruguay(),
1967            860usize => Country::uzbekistan(),
1968            548usize => Country::vanuatu(),
1969            704usize => Country::vietnam(),
1970            876usize => Country::wallis_and_futuna(),
1971            732usize => Country::western_sahara(),
1972            887usize => Country::yemen(),
1973            894usize => Country::zambia(),
1974            716usize => Country::zimbabwe(),
1975        };
1976        VALUES.get(&value).copied().ok_or("invalid value")
1977    }
1978
1979    /// Given the three digit code, return a country or an error if
1980    /// the parameter doesn't match any country. The value MUST be
1981    /// the three digit code which includes leading zeros.
1982    ///
1983    /// # Errors
1984    ///
1985    /// Returns an error if the code does not match any known country.
1986    ///
1987    /// ```
1988    /// use celes::Country;
1989    ///
1990    /// let res = Country::from_code("8");
1991    /// assert!(res.is_err());
1992    ///
1993    /// let res = Country::from_code("08");
1994    /// assert!(res.is_err());
1995    ///
1996    /// let res = Country::from_code("008");
1997    /// assert!(res.is_ok());
1998    ///
1999    /// assert_eq!(Country::albania(), res.unwrap());
2000    /// ```
2001    #[allow(clippy::too_many_lines)]
2002    pub fn from_code<A: AsRef<str>>(code: A) -> Result<Self, &'static str> {
2003        static CODES: Map<&'static str, Country> = phf_map! {
2004            "004" => Country::afghanistan(),
2005            "248" => Country::aland_islands(),
2006            "008" => Country::albania(),
2007            "012" => Country::algeria(),
2008            "016" => Country::american_samoa(),
2009            "020" => Country::andorra(),
2010            "024" => Country::angola(),
2011            "660" => Country::anguilla(),
2012            "010" => Country::antarctica(),
2013            "028" => Country::antigua_and_barbuda(),
2014            "032" => Country::argentina(),
2015            "051" => Country::armenia(),
2016            "533" => Country::aruba(),
2017            "654" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2018            "036" => Country::australia(),
2019            "040" => Country::austria(),
2020            "031" => Country::azerbaijan(),
2021            "048" => Country::bahrain(),
2022            "050" => Country::bangladesh(),
2023            "052" => Country::barbados(),
2024            "112" => Country::belarus(),
2025            "056" => Country::belgium(),
2026            "084" => Country::belize(),
2027            "204" => Country::benin(),
2028            "060" => Country::bermuda(),
2029            "064" => Country::bhutan(),
2030            "862" => Country::bolivarian_republic_of_venezuela(),
2031            "068" => Country::bolivia(),
2032            "535" => Country::bonaire(),
2033            "070" => Country::bosnia_and_herzegovina(),
2034            "072" => Country::botswana(),
2035            "074" => Country::bouvet_island(),
2036            "076" => Country::brazil(),
2037            "086" => Country::british_indian_ocean_territory(),
2038            "092" => Country::british_virgin_islands(),
2039            "096" => Country::brunei_darussalam(),
2040            "100" => Country::bulgaria(),
2041            "854" => Country::burkina_faso(),
2042            "108" => Country::burundi(),
2043            "132" => Country::cabo_verde(),
2044            "116" => Country::cambodia(),
2045            "120" => Country::cameroon(),
2046            "124" => Country::canada(),
2047            "148" => Country::chad(),
2048            "152" => Country::chile(),
2049            "156" => Country::china(),
2050            "162" => Country::christmas_island(),
2051            "170" => Country::colombia(),
2052            "188" => Country::costa_rica(),
2053            "384" => Country::coted_ivoire(),
2054            "191" => Country::croatia(),
2055            "192" => Country::cuba(),
2056            "531" => Country::curacao(),
2057            "196" => Country::cyprus(),
2058            "203" => Country::czechia(),
2059            "208" => Country::denmark(),
2060            "262" => Country::djibouti(),
2061            "212" => Country::dominica(),
2062            "534" => Country::dutch_part_sint_maarten(),
2063            "218" => Country::ecuador(),
2064            "818" => Country::egypt(),
2065            "222" => Country::el_salvador(),
2066            "226" => Country::equatorial_guinea(),
2067            "232" => Country::eritrea(),
2068            "233" => Country::estonia(),
2069            "748" => Country::eswatini(),
2070            "231" => Country::ethiopia(),
2071            "583" => Country::federated_states_of_micronesia(),
2072            "242" => Country::fiji(),
2073            "246" => Country::finland(),
2074            "250" => Country::france(),
2075            "254" => Country::french_guiana(),
2076            "663" => Country::french_part_saint_martin(),
2077            "258" => Country::french_polynesia(),
2078            "266" => Country::gabon(),
2079            "268" => Country::georgia(),
2080            "276" => Country::germany(),
2081            "288" => Country::ghana(),
2082            "292" => Country::gibraltar(),
2083            "300" => Country::greece(),
2084            "304" => Country::greenland(),
2085            "308" => Country::grenada(),
2086            "312" => Country::guadeloupe(),
2087            "316" => Country::guam(),
2088            "320" => Country::guatemala(),
2089            "831" => Country::guernsey(),
2090            "324" => Country::guinea(),
2091            "624" => Country::guinea_bissau(),
2092            "328" => Country::guyana(),
2093            "332" => Country::haiti(),
2094            "334" => Country::heard_island_and_mc_donald_islands(),
2095            "340" => Country::honduras(),
2096            "344" => Country::hong_kong(),
2097            "348" => Country::hungary(),
2098            "352" => Country::iceland(),
2099            "356" => Country::india(),
2100            "360" => Country::indonesia(),
2101            "368" => Country::iraq(),
2102            "372" => Country::ireland(),
2103            "364" => Country::islamic_republic_of_iran(),
2104            "833" => Country::isle_of_man(),
2105            "376" => Country::israel(),
2106            "380" => Country::italy(),
2107            "388" => Country::jamaica(),
2108            "392" => Country::japan(),
2109            "832" => Country::jersey(),
2110            "400" => Country::jordan(),
2111            "398" => Country::kazakhstan(),
2112            "404" => Country::kenya(),
2113            "296" => Country::kiribati(),
2114            "383" => Country::kosovo(),
2115            "414" => Country::kuwait(),
2116            "417" => Country::kyrgyzstan(),
2117            "428" => Country::latvia(),
2118            "422" => Country::lebanon(),
2119            "426" => Country::lesotho(),
2120            "430" => Country::liberia(),
2121            "434" => Country::libya(),
2122            "438" => Country::liechtenstein(),
2123            "440" => Country::lithuania(),
2124            "442" => Country::luxembourg(),
2125            "446" => Country::macao(),
2126            "450" => Country::madagascar(),
2127            "454" => Country::malawi(),
2128            "458" => Country::malaysia(),
2129            "462" => Country::maldives(),
2130            "466" => Country::mali(),
2131            "470" => Country::malta(),
2132            "474" => Country::martinique(),
2133            "478" => Country::mauritania(),
2134            "480" => Country::mauritius(),
2135            "175" => Country::mayotte(),
2136            "484" => Country::mexico(),
2137            "492" => Country::monaco(),
2138            "496" => Country::mongolia(),
2139            "499" => Country::montenegro(),
2140            "500" => Country::montserrat(),
2141            "504" => Country::morocco(),
2142            "508" => Country::mozambique(),
2143            "104" => Country::myanmar(),
2144            "516" => Country::namibia(),
2145            "520" => Country::nauru(),
2146            "524" => Country::nepal(),
2147            "540" => Country::new_caledonia(),
2148            "554" => Country::new_zealand(),
2149            "558" => Country::nicaragua(),
2150            "566" => Country::nigeria(),
2151            "570" => Country::niue(),
2152            "574" => Country::norfolk_island(),
2153            "578" => Country::norway(),
2154            "512" => Country::oman(),
2155            "586" => Country::pakistan(),
2156            "585" => Country::palau(),
2157            "591" => Country::panama(),
2158            "598" => Country::papua_new_guinea(),
2159            "600" => Country::paraguay(),
2160            "604" => Country::peru(),
2161            "612" => Country::pitcairn(),
2162            "616" => Country::poland(),
2163            "620" => Country::portugal(),
2164            "630" => Country::puerto_rico(),
2165            "634" => Country::qatar(),
2166            "807" => Country::republic_of_north_macedonia(),
2167            "638" => Country::reunion(),
2168            "642" => Country::romania(),
2169            "646" => Country::rwanda(),
2170            "652" => Country::saint_barthelemy(),
2171            "659" => Country::saint_kitts_and_nevis(),
2172            "662" => Country::saint_lucia(),
2173            "666" => Country::saint_pierre_and_miquelon(),
2174            "670" => Country::saint_vincent_and_the_grenadines(),
2175            "882" => Country::samoa(),
2176            "674" => Country::san_marino(),
2177            "678" => Country::sao_tome_and_principe(),
2178            "682" => Country::saudi_arabia(),
2179            "686" => Country::senegal(),
2180            "688" => Country::serbia(),
2181            "690" => Country::seychelles(),
2182            "694" => Country::sierra_leone(),
2183            "702" => Country::singapore(),
2184            "703" => Country::slovakia(),
2185            "705" => Country::slovenia(),
2186            "090" => Country::solomon_islands(),
2187            "706" => Country::somalia(),
2188            "710" => Country::south_africa(),
2189            "239" => Country::south_georgia_and_the_south_sandwich_islands(),
2190            "728" => Country::south_sudan(),
2191            "724" => Country::spain(),
2192            "144" => Country::sri_lanka(),
2193            "275" => Country::state_of_palestine(),
2194            "740" => Country::suriname(),
2195            "744" => Country::svalbard_and_jan_mayen(),
2196            "752" => Country::sweden(),
2197            "756" => Country::switzerland(),
2198            "760" => Country::syrian_arab_republic(),
2199            "158" => Country::taiwan(),
2200            "762" => Country::tajikistan(),
2201            "764" => Country::thailand(),
2202            "044" => Country::the_bahamas(),
2203            "136" => Country::the_cayman_islands(),
2204            "140" => Country::the_central_african_republic(),
2205            "166" => Country::the_cocos_keeling_islands(),
2206            "174" => Country::the_comoros(),
2207            "178" => Country::the_congo(),
2208            "184" => Country::the_cook_islands(),
2209            "408" => Country::the_democratic_peoples_republic_of_korea(),
2210            "180" => Country::the_democratic_republic_of_the_congo(),
2211            "214" => Country::the_dominican_republic(),
2212            "238" => Country::the_falkland_islands_malvinas(),
2213            "234" => Country::the_faroe_islands(),
2214            "260" => Country::the_french_southern_territories(),
2215            "270" => Country::the_gambia(),
2216            "336" => Country::the_holy_see(),
2217            "418" => Country::the_lao_peoples_democratic_republic(),
2218            "584" => Country::the_marshall_islands(),
2219            "528" => Country::the_netherlands(),
2220            "562" => Country::the_niger(),
2221            "580" => Country::the_northern_mariana_islands(),
2222            "608" => Country::the_philippines(),
2223            "410" => Country::the_republic_of_korea(),
2224            "498" => Country::the_republic_of_moldova(),
2225            "643" => Country::the_russian_federation(),
2226            "729" => Country::the_sudan(),
2227            "796" => Country::the_turks_and_caicos_islands(),
2228            "784" => Country::the_united_arab_emirates(),
2229            "826" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2230            "581" => Country::the_united_states_minor_outlying_islands(),
2231            "840" => Country::the_united_states_of_america(),
2232            "626" => Country::timor_leste(),
2233            "768" => Country::togo(),
2234            "772" => Country::tokelau(),
2235            "776" => Country::tonga(),
2236            "780" => Country::trinidad_and_tobago(),
2237            "788" => Country::tunisia(),
2238            "792" => Country::turkiye(),
2239            "795" => Country::turkmenistan(),
2240            "798" => Country::tuvalu(),
2241            "850" => Country::us_virgin_islands(),
2242            "800" => Country::uganda(),
2243            "804" => Country::ukraine(),
2244            "834" => Country::united_republic_of_tanzania(),
2245            "858" => Country::uruguay(),
2246            "860" => Country::uzbekistan(),
2247            "548" => Country::vanuatu(),
2248            "704" => Country::vietnam(),
2249            "876" => Country::wallis_and_futuna(),
2250            "732" => Country::western_sahara(),
2251            "887" => Country::yemen(),
2252            "894" => Country::zambia(),
2253            "716" => Country::zimbabwe(),
2254        };
2255        CODES.get(code.as_ref()).copied().ok_or("invalid code")
2256    }
2257
2258    /// Given the alpha2 letters, return a country or an error if
2259    /// the parameter doesn't match any country. This is case-insensitive.
2260    ///
2261    /// # Errors
2262    ///
2263    /// Returns an error if the alpha2 code does not match any known country.
2264    ///
2265    /// ```
2266    /// use celes::Country;
2267    ///
2268    /// let res = Country::from_alpha2("u");
2269    /// assert!(res.is_err());
2270    ///
2271    /// let res = Country::from_alpha2("us");
2272    /// assert!(res.is_ok());
2273    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2274    ///
2275    /// let res = Country::from_alpha2("Us");
2276    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2277    ///
2278    /// let res = Country::from_alpha2("uS");
2279    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2280    ///
2281    /// let res = Country::from_alpha2("US");
2282    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2283    /// ```
2284    #[allow(clippy::too_many_lines)]
2285    pub fn from_alpha2<A: AsRef<str>>(alpha2: A) -> Result<Self, &'static str> {
2286        static ALPHA2: Map<&'static str, Country> = phf_map! {
2287            "af" => Country::afghanistan(),
2288            "ax" => Country::aland_islands(),
2289            "al" => Country::albania(),
2290            "dz" => Country::algeria(),
2291            "as" => Country::american_samoa(),
2292            "ad" => Country::andorra(),
2293            "ao" => Country::angola(),
2294            "ai" => Country::anguilla(),
2295            "aq" => Country::antarctica(),
2296            "ag" => Country::antigua_and_barbuda(),
2297            "ar" => Country::argentina(),
2298            "am" => Country::armenia(),
2299            "aw" => Country::aruba(),
2300            "sh" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2301            "au" => Country::australia(),
2302            "at" => Country::austria(),
2303            "az" => Country::azerbaijan(),
2304            "bh" => Country::bahrain(),
2305            "bd" => Country::bangladesh(),
2306            "bb" => Country::barbados(),
2307            "by" => Country::belarus(),
2308            "be" => Country::belgium(),
2309            "bz" => Country::belize(),
2310            "bj" => Country::benin(),
2311            "bm" => Country::bermuda(),
2312            "bt" => Country::bhutan(),
2313            "ve" => Country::bolivarian_republic_of_venezuela(),
2314            "bo" => Country::bolivia(),
2315            "bq" => Country::bonaire(),
2316            "ba" => Country::bosnia_and_herzegovina(),
2317            "bw" => Country::botswana(),
2318            "bv" => Country::bouvet_island(),
2319            "br" => Country::brazil(),
2320            "io" => Country::british_indian_ocean_territory(),
2321            "vg" => Country::british_virgin_islands(),
2322            "bn" => Country::brunei_darussalam(),
2323            "bg" => Country::bulgaria(),
2324            "bf" => Country::burkina_faso(),
2325            "bi" => Country::burundi(),
2326            "cv" => Country::cabo_verde(),
2327            "kh" => Country::cambodia(),
2328            "cm" => Country::cameroon(),
2329            "ca" => Country::canada(),
2330            "td" => Country::chad(),
2331            "cl" => Country::chile(),
2332            "cn" => Country::china(),
2333            "cx" => Country::christmas_island(),
2334            "co" => Country::colombia(),
2335            "cr" => Country::costa_rica(),
2336            "ci" => Country::coted_ivoire(),
2337            "hr" => Country::croatia(),
2338            "cu" => Country::cuba(),
2339            "cw" => Country::curacao(),
2340            "cy" => Country::cyprus(),
2341            "cz" => Country::czechia(),
2342            "dk" => Country::denmark(),
2343            "dj" => Country::djibouti(),
2344            "dm" => Country::dominica(),
2345            "sx" => Country::dutch_part_sint_maarten(),
2346            "ec" => Country::ecuador(),
2347            "eg" => Country::egypt(),
2348            "sv" => Country::el_salvador(),
2349            "gq" => Country::equatorial_guinea(),
2350            "er" => Country::eritrea(),
2351            "ee" => Country::estonia(),
2352            "sz" => Country::eswatini(),
2353            "et" => Country::ethiopia(),
2354            "fm" => Country::federated_states_of_micronesia(),
2355            "fj" => Country::fiji(),
2356            "fi" => Country::finland(),
2357            "fr" => Country::france(),
2358            "gf" => Country::french_guiana(),
2359            "mf" => Country::french_part_saint_martin(),
2360            "pf" => Country::french_polynesia(),
2361            "ga" => Country::gabon(),
2362            "ge" => Country::georgia(),
2363            "de" => Country::germany(),
2364            "gh" => Country::ghana(),
2365            "gi" => Country::gibraltar(),
2366            "gr" => Country::greece(),
2367            "gl" => Country::greenland(),
2368            "gd" => Country::grenada(),
2369            "gp" => Country::guadeloupe(),
2370            "gu" => Country::guam(),
2371            "gt" => Country::guatemala(),
2372            "gg" => Country::guernsey(),
2373            "gn" => Country::guinea(),
2374            "gw" => Country::guinea_bissau(),
2375            "gy" => Country::guyana(),
2376            "ht" => Country::haiti(),
2377            "hm" => Country::heard_island_and_mc_donald_islands(),
2378            "hn" => Country::honduras(),
2379            "hk" => Country::hong_kong(),
2380            "hu" => Country::hungary(),
2381            "is" => Country::iceland(),
2382            "in" => Country::india(),
2383            "id" => Country::indonesia(),
2384            "iq" => Country::iraq(),
2385            "ie" => Country::ireland(),
2386            "ir" => Country::islamic_republic_of_iran(),
2387            "im" => Country::isle_of_man(),
2388            "il" => Country::israel(),
2389            "it" => Country::italy(),
2390            "jm" => Country::jamaica(),
2391            "jp" => Country::japan(),
2392            "je" => Country::jersey(),
2393            "jo" => Country::jordan(),
2394            "kz" => Country::kazakhstan(),
2395            "ke" => Country::kenya(),
2396            "ki" => Country::kiribati(),
2397            "xk" => Country::kosovo(),
2398            "kw" => Country::kuwait(),
2399            "kg" => Country::kyrgyzstan(),
2400            "lv" => Country::latvia(),
2401            "lb" => Country::lebanon(),
2402            "ls" => Country::lesotho(),
2403            "lr" => Country::liberia(),
2404            "ly" => Country::libya(),
2405            "li" => Country::liechtenstein(),
2406            "lt" => Country::lithuania(),
2407            "lu" => Country::luxembourg(),
2408            "mo" => Country::macao(),
2409            "mg" => Country::madagascar(),
2410            "mw" => Country::malawi(),
2411            "my" => Country::malaysia(),
2412            "mv" => Country::maldives(),
2413            "ml" => Country::mali(),
2414            "mt" => Country::malta(),
2415            "mq" => Country::martinique(),
2416            "mr" => Country::mauritania(),
2417            "mu" => Country::mauritius(),
2418            "yt" => Country::mayotte(),
2419            "mx" => Country::mexico(),
2420            "mc" => Country::monaco(),
2421            "mn" => Country::mongolia(),
2422            "me" => Country::montenegro(),
2423            "ms" => Country::montserrat(),
2424            "ma" => Country::morocco(),
2425            "mz" => Country::mozambique(),
2426            "mm" => Country::myanmar(),
2427            "na" => Country::namibia(),
2428            "nr" => Country::nauru(),
2429            "np" => Country::nepal(),
2430            "nc" => Country::new_caledonia(),
2431            "nz" => Country::new_zealand(),
2432            "ni" => Country::nicaragua(),
2433            "ng" => Country::nigeria(),
2434            "nu" => Country::niue(),
2435            "nf" => Country::norfolk_island(),
2436            "no" => Country::norway(),
2437            "om" => Country::oman(),
2438            "pk" => Country::pakistan(),
2439            "pw" => Country::palau(),
2440            "pa" => Country::panama(),
2441            "pg" => Country::papua_new_guinea(),
2442            "py" => Country::paraguay(),
2443            "pe" => Country::peru(),
2444            "pn" => Country::pitcairn(),
2445            "pl" => Country::poland(),
2446            "pt" => Country::portugal(),
2447            "pr" => Country::puerto_rico(),
2448            "qa" => Country::qatar(),
2449            "mk" => Country::republic_of_north_macedonia(),
2450            "re" => Country::reunion(),
2451            "ro" => Country::romania(),
2452            "rw" => Country::rwanda(),
2453            "bl" => Country::saint_barthelemy(),
2454            "kn" => Country::saint_kitts_and_nevis(),
2455            "lc" => Country::saint_lucia(),
2456            "pm" => Country::saint_pierre_and_miquelon(),
2457            "vc" => Country::saint_vincent_and_the_grenadines(),
2458            "ws" => Country::samoa(),
2459            "sm" => Country::san_marino(),
2460            "st" => Country::sao_tome_and_principe(),
2461            "sa" => Country::saudi_arabia(),
2462            "sn" => Country::senegal(),
2463            "rs" => Country::serbia(),
2464            "sc" => Country::seychelles(),
2465            "sl" => Country::sierra_leone(),
2466            "sg" => Country::singapore(),
2467            "sk" => Country::slovakia(),
2468            "si" => Country::slovenia(),
2469            "sb" => Country::solomon_islands(),
2470            "so" => Country::somalia(),
2471            "za" => Country::south_africa(),
2472            "gs" => Country::south_georgia_and_the_south_sandwich_islands(),
2473            "ss" => Country::south_sudan(),
2474            "es" => Country::spain(),
2475            "lk" => Country::sri_lanka(),
2476            "ps" => Country::state_of_palestine(),
2477            "sr" => Country::suriname(),
2478            "sj" => Country::svalbard_and_jan_mayen(),
2479            "se" => Country::sweden(),
2480            "ch" => Country::switzerland(),
2481            "sy" => Country::syrian_arab_republic(),
2482            "tw" => Country::taiwan(),
2483            "tj" => Country::tajikistan(),
2484            "th" => Country::thailand(),
2485            "bs" => Country::the_bahamas(),
2486            "ky" => Country::the_cayman_islands(),
2487            "cf" => Country::the_central_african_republic(),
2488            "cc" => Country::the_cocos_keeling_islands(),
2489            "km" => Country::the_comoros(),
2490            "cg" => Country::the_congo(),
2491            "ck" => Country::the_cook_islands(),
2492            "kp" => Country::the_democratic_peoples_republic_of_korea(),
2493            "cd" => Country::the_democratic_republic_of_the_congo(),
2494            "do" => Country::the_dominican_republic(),
2495            "fk" => Country::the_falkland_islands_malvinas(),
2496            "fo" => Country::the_faroe_islands(),
2497            "tf" => Country::the_french_southern_territories(),
2498            "gm" => Country::the_gambia(),
2499            "va" => Country::the_holy_see(),
2500            "la" => Country::the_lao_peoples_democratic_republic(),
2501            "mh" => Country::the_marshall_islands(),
2502            "nl" => Country::the_netherlands(),
2503            "ne" => Country::the_niger(),
2504            "mp" => Country::the_northern_mariana_islands(),
2505            "ph" => Country::the_philippines(),
2506            "kr" => Country::the_republic_of_korea(),
2507            "md" => Country::the_republic_of_moldova(),
2508            "ru" => Country::the_russian_federation(),
2509            "sd" => Country::the_sudan(),
2510            "tc" => Country::the_turks_and_caicos_islands(),
2511            "ae" => Country::the_united_arab_emirates(),
2512            "gb" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2513            "um" => Country::the_united_states_minor_outlying_islands(),
2514            "us" => Country::the_united_states_of_america(),
2515            "tl" => Country::timor_leste(),
2516            "tg" => Country::togo(),
2517            "tk" => Country::tokelau(),
2518            "to" => Country::tonga(),
2519            "tt" => Country::trinidad_and_tobago(),
2520            "tn" => Country::tunisia(),
2521            "tr" => Country::turkiye(),
2522            "tm" => Country::turkmenistan(),
2523            "tv" => Country::tuvalu(),
2524            "vi" => Country::us_virgin_islands(),
2525            "ug" => Country::uganda(),
2526            "ua" => Country::ukraine(),
2527            "tz" => Country::united_republic_of_tanzania(),
2528            "uy" => Country::uruguay(),
2529            "uz" => Country::uzbekistan(),
2530            "vu" => Country::vanuatu(),
2531            "vn" => Country::vietnam(),
2532            "wf" => Country::wallis_and_futuna(),
2533            "eh" => Country::western_sahara(),
2534            "ye" => Country::yemen(),
2535            "zm" => Country::zambia(),
2536            "zw" => Country::zimbabwe(),
2537        };
2538        lookup_ascii_lowercase(&ALPHA2, alpha2.as_ref())
2539            .copied()
2540            .ok_or("invalid alpha2")
2541    }
2542
2543    /// Given the alpha3 letters, return a country or an error if
2544    /// the parameter doesn't match any country. This is case-insensitive.
2545    ///
2546    /// # Errors
2547    ///
2548    /// Returns an error if the alpha3 code does not match any known country.
2549    ///
2550    /// ```
2551    /// use celes::Country;
2552    ///
2553    /// let res = Country::from_alpha3("u");
2554    /// assert!(res.is_err());
2555    ///
2556    /// let res = Country::from_alpha3("us");
2557    /// assert!(res.is_err());
2558    ///
2559    /// let res = Country::from_alpha3("Usa");
2560    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2561    ///
2562    /// let res = Country::from_alpha3("uSa");
2563    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2564    ///
2565    /// let res = Country::from_alpha3("USA");
2566    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2567    /// ```
2568    #[allow(clippy::too_many_lines)]
2569    pub fn from_alpha3<A: AsRef<str>>(alpha3: A) -> Result<Self, &'static str> {
2570        static ALPHA3: Map<&'static str, Country> = phf_map! {
2571            "afg" => Country::afghanistan(),
2572            "ala" => Country::aland_islands(),
2573            "alb" => Country::albania(),
2574            "dza" => Country::algeria(),
2575            "asm" => Country::american_samoa(),
2576            "and" => Country::andorra(),
2577            "ago" => Country::angola(),
2578            "aia" => Country::anguilla(),
2579            "ata" => Country::antarctica(),
2580            "atg" => Country::antigua_and_barbuda(),
2581            "arg" => Country::argentina(),
2582            "arm" => Country::armenia(),
2583            "abw" => Country::aruba(),
2584            "shn" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2585            "aus" => Country::australia(),
2586            "aut" => Country::austria(),
2587            "aze" => Country::azerbaijan(),
2588            "bhr" => Country::bahrain(),
2589            "bgd" => Country::bangladesh(),
2590            "brb" => Country::barbados(),
2591            "blr" => Country::belarus(),
2592            "bel" => Country::belgium(),
2593            "blz" => Country::belize(),
2594            "ben" => Country::benin(),
2595            "bmu" => Country::bermuda(),
2596            "btn" => Country::bhutan(),
2597            "ven" => Country::bolivarian_republic_of_venezuela(),
2598            "bol" => Country::bolivia(),
2599            "bes" => Country::bonaire(),
2600            "bih" => Country::bosnia_and_herzegovina(),
2601            "bwa" => Country::botswana(),
2602            "bvt" => Country::bouvet_island(),
2603            "bra" => Country::brazil(),
2604            "iot" => Country::british_indian_ocean_territory(),
2605            "vgb" => Country::british_virgin_islands(),
2606            "brn" => Country::brunei_darussalam(),
2607            "bgr" => Country::bulgaria(),
2608            "bfa" => Country::burkina_faso(),
2609            "bdi" => Country::burundi(),
2610            "cpv" => Country::cabo_verde(),
2611            "khm" => Country::cambodia(),
2612            "cmr" => Country::cameroon(),
2613            "can" => Country::canada(),
2614            "tcd" => Country::chad(),
2615            "chl" => Country::chile(),
2616            "chn" => Country::china(),
2617            "cxr" => Country::christmas_island(),
2618            "col" => Country::colombia(),
2619            "cri" => Country::costa_rica(),
2620            "civ" => Country::coted_ivoire(),
2621            "hrv" => Country::croatia(),
2622            "cub" => Country::cuba(),
2623            "cuw" => Country::curacao(),
2624            "cyp" => Country::cyprus(),
2625            "cze" => Country::czechia(),
2626            "dnk" => Country::denmark(),
2627            "dji" => Country::djibouti(),
2628            "dma" => Country::dominica(),
2629            "sxm" => Country::dutch_part_sint_maarten(),
2630            "ecu" => Country::ecuador(),
2631            "egy" => Country::egypt(),
2632            "slv" => Country::el_salvador(),
2633            "gnq" => Country::equatorial_guinea(),
2634            "eri" => Country::eritrea(),
2635            "est" => Country::estonia(),
2636            "swz" => Country::eswatini(),
2637            "eth" => Country::ethiopia(),
2638            "fsm" => Country::federated_states_of_micronesia(),
2639            "fji" => Country::fiji(),
2640            "fin" => Country::finland(),
2641            "fra" => Country::france(),
2642            "guf" => Country::french_guiana(),
2643            "maf" => Country::french_part_saint_martin(),
2644            "pyf" => Country::french_polynesia(),
2645            "gab" => Country::gabon(),
2646            "geo" => Country::georgia(),
2647            "deu" => Country::germany(),
2648            "gha" => Country::ghana(),
2649            "gib" => Country::gibraltar(),
2650            "grc" => Country::greece(),
2651            "grl" => Country::greenland(),
2652            "grd" => Country::grenada(),
2653            "glp" => Country::guadeloupe(),
2654            "gum" => Country::guam(),
2655            "gtm" => Country::guatemala(),
2656            "ggy" => Country::guernsey(),
2657            "gin" => Country::guinea(),
2658            "gnb" => Country::guinea_bissau(),
2659            "guy" => Country::guyana(),
2660            "hti" => Country::haiti(),
2661            "hmd" => Country::heard_island_and_mc_donald_islands(),
2662            "hnd" => Country::honduras(),
2663            "hkg" => Country::hong_kong(),
2664            "hun" => Country::hungary(),
2665            "isl" => Country::iceland(),
2666            "ind" => Country::india(),
2667            "idn" => Country::indonesia(),
2668            "irq" => Country::iraq(),
2669            "irl" => Country::ireland(),
2670            "irn" => Country::islamic_republic_of_iran(),
2671            "imn" => Country::isle_of_man(),
2672            "isr" => Country::israel(),
2673            "ita" => Country::italy(),
2674            "jam" => Country::jamaica(),
2675            "jpn" => Country::japan(),
2676            "jey" => Country::jersey(),
2677            "jor" => Country::jordan(),
2678            "kaz" => Country::kazakhstan(),
2679            "ken" => Country::kenya(),
2680            "xkx" => Country::kosovo(),
2681            "kir" => Country::kiribati(),
2682            "kwt" => Country::kuwait(),
2683            "kgz" => Country::kyrgyzstan(),
2684            "lva" => Country::latvia(),
2685            "lbn" => Country::lebanon(),
2686            "lso" => Country::lesotho(),
2687            "lbr" => Country::liberia(),
2688            "lby" => Country::libya(),
2689            "lie" => Country::liechtenstein(),
2690            "ltu" => Country::lithuania(),
2691            "lux" => Country::luxembourg(),
2692            "mac" => Country::macao(),
2693            "mdg" => Country::madagascar(),
2694            "mwi" => Country::malawi(),
2695            "mys" => Country::malaysia(),
2696            "mdv" => Country::maldives(),
2697            "mli" => Country::mali(),
2698            "mlt" => Country::malta(),
2699            "mtq" => Country::martinique(),
2700            "mrt" => Country::mauritania(),
2701            "mus" => Country::mauritius(),
2702            "myt" => Country::mayotte(),
2703            "mex" => Country::mexico(),
2704            "mco" => Country::monaco(),
2705            "mng" => Country::mongolia(),
2706            "mne" => Country::montenegro(),
2707            "msr" => Country::montserrat(),
2708            "mar" => Country::morocco(),
2709            "moz" => Country::mozambique(),
2710            "mmr" => Country::myanmar(),
2711            "nam" => Country::namibia(),
2712            "nru" => Country::nauru(),
2713            "npl" => Country::nepal(),
2714            "ncl" => Country::new_caledonia(),
2715            "nzl" => Country::new_zealand(),
2716            "nic" => Country::nicaragua(),
2717            "nga" => Country::nigeria(),
2718            "niu" => Country::niue(),
2719            "nfk" => Country::norfolk_island(),
2720            "nor" => Country::norway(),
2721            "omn" => Country::oman(),
2722            "pak" => Country::pakistan(),
2723            "plw" => Country::palau(),
2724            "pan" => Country::panama(),
2725            "png" => Country::papua_new_guinea(),
2726            "pry" => Country::paraguay(),
2727            "per" => Country::peru(),
2728            "pcn" => Country::pitcairn(),
2729            "pol" => Country::poland(),
2730            "prt" => Country::portugal(),
2731            "pri" => Country::puerto_rico(),
2732            "qat" => Country::qatar(),
2733            "mkd" => Country::republic_of_north_macedonia(),
2734            "reu" => Country::reunion(),
2735            "rou" => Country::romania(),
2736            "rwa" => Country::rwanda(),
2737            "blm" => Country::saint_barthelemy(),
2738            "kna" => Country::saint_kitts_and_nevis(),
2739            "lca" => Country::saint_lucia(),
2740            "spm" => Country::saint_pierre_and_miquelon(),
2741            "vct" => Country::saint_vincent_and_the_grenadines(),
2742            "wsm" => Country::samoa(),
2743            "smr" => Country::san_marino(),
2744            "stp" => Country::sao_tome_and_principe(),
2745            "sau" => Country::saudi_arabia(),
2746            "sen" => Country::senegal(),
2747            "srb" => Country::serbia(),
2748            "syc" => Country::seychelles(),
2749            "sle" => Country::sierra_leone(),
2750            "sgp" => Country::singapore(),
2751            "svk" => Country::slovakia(),
2752            "svn" => Country::slovenia(),
2753            "slb" => Country::solomon_islands(),
2754            "som" => Country::somalia(),
2755            "zaf" => Country::south_africa(),
2756            "sgs" => Country::south_georgia_and_the_south_sandwich_islands(),
2757            "ssd" => Country::south_sudan(),
2758            "esp" => Country::spain(),
2759            "lka" => Country::sri_lanka(),
2760            "pse" => Country::state_of_palestine(),
2761            "sur" => Country::suriname(),
2762            "sjm" => Country::svalbard_and_jan_mayen(),
2763            "swe" => Country::sweden(),
2764            "che" => Country::switzerland(),
2765            "syr" => Country::syrian_arab_republic(),
2766            "twn" => Country::taiwan(),
2767            "tjk" => Country::tajikistan(),
2768            "tha" => Country::thailand(),
2769            "bhs" => Country::the_bahamas(),
2770            "cym" => Country::the_cayman_islands(),
2771            "caf" => Country::the_central_african_republic(),
2772            "cck" => Country::the_cocos_keeling_islands(),
2773            "com" => Country::the_comoros(),
2774            "cog" => Country::the_congo(),
2775            "cok" => Country::the_cook_islands(),
2776            "prk" => Country::the_democratic_peoples_republic_of_korea(),
2777            "cod" => Country::the_democratic_republic_of_the_congo(),
2778            "dom" => Country::the_dominican_republic(),
2779            "flk" => Country::the_falkland_islands_malvinas(),
2780            "fro" => Country::the_faroe_islands(),
2781            "atf" => Country::the_french_southern_territories(),
2782            "gmb" => Country::the_gambia(),
2783            "vat" => Country::the_holy_see(),
2784            "lao" => Country::the_lao_peoples_democratic_republic(),
2785            "mhl" => Country::the_marshall_islands(),
2786            "nld" => Country::the_netherlands(),
2787            "ner" => Country::the_niger(),
2788            "mnp" => Country::the_northern_mariana_islands(),
2789            "phl" => Country::the_philippines(),
2790            "kor" => Country::the_republic_of_korea(),
2791            "mda" => Country::the_republic_of_moldova(),
2792            "rus" => Country::the_russian_federation(),
2793            "sdn" => Country::the_sudan(),
2794            "tca" => Country::the_turks_and_caicos_islands(),
2795            "are" => Country::the_united_arab_emirates(),
2796            "gbr" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2797            "umi" => Country::the_united_states_minor_outlying_islands(),
2798            "usa" => Country::the_united_states_of_america(),
2799            "tls" => Country::timor_leste(),
2800            "tgo" => Country::togo(),
2801            "tkl" => Country::tokelau(),
2802            "ton" => Country::tonga(),
2803            "tto" => Country::trinidad_and_tobago(),
2804            "tun" => Country::tunisia(),
2805            "tur" => Country::turkiye(),
2806            "tkm" => Country::turkmenistan(),
2807            "tuv" => Country::tuvalu(),
2808            "vir" => Country::us_virgin_islands(),
2809            "uga" => Country::uganda(),
2810            "ukr" => Country::ukraine(),
2811            "tza" => Country::united_republic_of_tanzania(),
2812            "ury" => Country::uruguay(),
2813            "uzb" => Country::uzbekistan(),
2814            "vut" => Country::vanuatu(),
2815            "vnm" => Country::vietnam(),
2816            "wlf" => Country::wallis_and_futuna(),
2817            "esh" => Country::western_sahara(),
2818            "yem" => Country::yemen(),
2819            "zmb" => Country::zambia(),
2820            "zwe" => Country::zimbabwe(),
2821        };
2822        lookup_ascii_lowercase(&ALPHA3, alpha3.as_ref())
2823            .copied()
2824            .ok_or("invalid alpha3")
2825    }
2826
2827    /// Given a country alias, return a country or an error if
2828    /// the parameter doesn't match any country
2829    ///
2830    /// The alias is any value in the `aliases` field for a country.
2831    /// For example, "america" would return `the_united_states_of_america`
2832    /// This is case-insensitive.
2833    ///
2834    /// # Errors
2835    ///
2836    /// Returns an error if the alias does not match any known country.
2837    ///
2838    /// ```
2839    /// use celes::Country;
2840    ///
2841    /// let res = Country::from_alias("u");
2842    /// assert!(res.is_err());
2843    ///
2844    /// let res = Country::from_alias("us");
2845    /// assert!(res.is_err());
2846    ///
2847    /// let res = Country::from_alias("america");
2848    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2849    ///
2850    /// let res = Country::from_alias("russia");
2851    /// assert_eq!(Country::the_russian_federation(), res.unwrap());
2852    ///
2853    /// let res = Country::from_alias("england");
2854    /// assert_eq!(Country::the_united_kingdom_of_great_britain_and_northern_ireland(), res.unwrap());
2855    /// ```
2856    #[allow(clippy::too_many_lines)]
2857    pub fn from_alias<A: AsRef<str>>(alias: A) -> Result<Self, &'static str> {
2858        static ALIASES: Map<&'static str, Country> = phf_map! {
2859            "samoa" => Country::american_samoa(),
2860            "sthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2861            "sainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
2862            "venezuela" => Country::bolivarian_republic_of_venezuela(),
2863            "bosnia" => Country::bosnia_and_herzegovina(),
2864            "herzegovina" => Country::bosnia_and_herzegovina(),
2865            "brunei" => Country::brunei_darussalam(),
2866            "burkina" => Country::burkina_faso(),
2867            "stmaarten" => Country::dutch_part_sint_maarten(),
2868            "saintmaarten" => Country::dutch_part_sint_maarten(),
2869            "micronesia" => Country::federated_states_of_micronesia(),
2870            "stmartin" => Country::french_part_saint_martin(),
2871            "saintmartin" => Country::french_part_saint_martin(),
2872            "heardisland" => Country::heard_island_and_mc_donald_islands(),
2873            "mcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
2874            "iran" => Country::islamic_republic_of_iran(),
2875            "macedonia" => Country::republic_of_north_macedonia(),
2876            "stbarthelemy" => Country::saint_barthelemy(),
2877            "stkitts" => Country::saint_kitts_and_nevis(),
2878            "stlucia" => Country::saint_lucia(),
2879            "stpierre" => Country::saint_pierre_and_miquelon(),
2880            "saintpierre" => Country::saint_pierre_and_miquelon(),
2881            "stvincent" => Country::saint_vincent_and_the_grenadines(),
2882            "saintvincent" => Country::saint_vincent_and_the_grenadines(),
2883            "saotome" => Country::sao_tome_and_principe(),
2884            "southgeorgia" => Country::south_georgia_and_the_south_sandwich_islands(),
2885            "southsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
2886            "palestine" => Country::state_of_palestine(),
2887            "taiwan" => Country::taiwan(),
2888            "bahamas" => Country::the_bahamas(),
2889            "caymanislands" => Country::the_cayman_islands(),
2890            "centralafricanrepublic" => Country::the_central_african_republic(),
2891            "cocosislands" => Country::the_cocos_keeling_islands(),
2892            "keelingislands" => Country::the_cocos_keeling_islands(),
2893            "comoros" => Country::the_comoros(),
2894            "congo" => Country::the_congo(),
2895            "cookislands" => Country::the_cook_islands(),
2896            "czechrepublic" => Country::czechia(),
2897            "northkorea" => Country::the_democratic_peoples_republic_of_korea(),
2898            "democraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
2899            "democraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
2900            "dominicanrepublic" => Country::the_dominican_republic(),
2901            "easttimor" => Country::timor_leste(),
2902            "malvinas" => Country::the_falkland_islands_malvinas(),
2903            "falklandislands" => Country::the_falkland_islands_malvinas(),
2904            "faroeislands" => Country::the_faroe_islands(),
2905            "frenchsouthernterritories" => Country::the_french_southern_territories(),
2906            "gambia" => Country::the_gambia(),
2907            "holysee" => Country::the_holy_see(),
2908            "laopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
2909            "marshallislands" => Country::the_marshall_islands(),
2910            "netherlands" => Country::the_netherlands(),
2911            "holland" => Country::the_netherlands(),
2912            "niger" => Country::the_niger(),
2913            "northernmarianaislands" => Country::the_northern_mariana_islands(),
2914            "philippines" => Country::the_philippines(),
2915            "southkorea" => Country::the_republic_of_korea(),
2916            "republicofkorea" => Country::the_republic_of_korea(),
2917            "moldova" => Country::the_republic_of_moldova(),
2918            "republicofmoldova" => Country::the_republic_of_moldova(),
2919            "russia" => Country::the_russian_federation(),
2920            "russianfederation" => Country::the_russian_federation(),
2921            "sudan" => Country::the_sudan(),
2922            "turksandcaicosislands" => Country::the_turks_and_caicos_islands(),
2923            "unitedarabemirates" => Country::the_united_arab_emirates(),
2924            "england" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2925            "scotland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2926            "greatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2927            "unitedkingdom" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2928            "northernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2929            "unitedkingdomofgreatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2930            "unitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
2931            "unitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
2932            "america" => Country::the_united_states_of_america(),
2933            "unitedstates" => Country::the_united_states_of_america(),
2934            "unitedstatesofamerica" => Country::the_united_states_of_america(),
2935            "trinidad" => Country::trinidad_and_tobago(),
2936            "tobago" => Country::trinidad_and_tobago(),
2937            "tanzania" => Country::united_republic_of_tanzania(),
2938            "türkiye" => Country::turkiye(),
2939            "turkiye" => Country::turkiye(),
2940            "turkey" => Country::turkiye(),
2941            "myanmar" => Country::myanmar(),
2942            "burma" => Country::myanmar(),
2943            "eswatini" => Country::eswatini(),
2944            "swaziland" => Country::eswatini(),
2945            "caboverde" => Country::cabo_verde(),
2946            "capeverde" => Country::cabo_verde(),
2947            "ivorycoast" => Country::coted_ivoire(),
2948            "cotedivoire" => Country::coted_ivoire(),
2949            "northmacedonia" => Country::republic_of_north_macedonia(),
2950            "syria" => Country::syrian_arab_republic(),
2951            "laos" => Country::the_lao_peoples_democratic_republic(),
2952            "macau" => Country::macao(),
2953            "vatican" => Country::the_holy_see(),
2954            "vaticancity" => Country::the_holy_see(),
2955        };
2956        lookup_ascii_lowercase(&ALIASES, alias.as_ref())
2957            .copied()
2958            .ok_or("invalid alias")
2959    }
2960
2961    /// Given the country name, return a country or an error if
2962    /// the parameter doesn't match any country.  This is case-insensitive.
2963    ///
2964    /// For example, Albania, Algeria, Brazil would return the country
2965    /// struct that represents those countries.
2966    ///
2967    /// # Errors
2968    ///
2969    /// Returns an error if the name does not match any known country.
2970    ///
2971    /// ```
2972    /// use celes::Country;
2973    ///
2974    /// let res = Country::from_name("russianfederation");
2975    /// assert!(res.is_err());
2976    ///
2977    /// let res = Country::from_name("unitedstatesofamerica");
2978    /// assert!(res.is_err());
2979    ///
2980    /// let res = Country::from_name("Albania");
2981    /// assert_eq!(Country::albania(), res.unwrap());
2982    ///
2983    /// let res = Country::from_name("theunitedstatesofamerica");
2984    /// assert_eq!(Country::the_united_states_of_america(), res.unwrap());
2985    ///
2986    /// let res = Country::from_name("therussianfederation");
2987    /// assert_eq!(Country::the_russian_federation(), res.unwrap());
2988    ///
2989    /// let res = Country::from_name("theunitedkingdomofgreatbritainandnorthernireland");
2990    /// assert_eq!(Country::the_united_kingdom_of_great_britain_and_northern_ireland(), res.unwrap());
2991    /// ```
2992    #[allow(clippy::too_many_lines)]
2993    pub fn from_name<A: AsRef<str>>(name: A) -> Result<Self, &'static str> {
2994        static NAMES: Map<&'static str, Country> = phf_map! {
2995            "afghanistan" => Country::afghanistan(),
2996            "alandislands" => Country::aland_islands(),
2997            "albania" => Country::albania(),
2998            "algeria" => Country::algeria(),
2999            "americansamoa" => Country::american_samoa(),
3000            "andorra" => Country::andorra(),
3001            "angola" => Country::angola(),
3002            "anguilla" => Country::anguilla(),
3003            "antarctica" => Country::antarctica(),
3004            "antiguaandbarbuda" => Country::antigua_and_barbuda(),
3005            "argentina" => Country::argentina(),
3006            "armenia" => Country::armenia(),
3007            "aruba" => Country::aruba(),
3008            "ascensionandtristandacunhasainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3009            "australia" => Country::australia(),
3010            "austria" => Country::austria(),
3011            "azerbaijan" => Country::azerbaijan(),
3012            "bahrain" => Country::bahrain(),
3013            "bangladesh" => Country::bangladesh(),
3014            "barbados" => Country::barbados(),
3015            "belarus" => Country::belarus(),
3016            "belgium" => Country::belgium(),
3017            "belize" => Country::belize(),
3018            "benin" => Country::benin(),
3019            "bermuda" => Country::bermuda(),
3020            "bhutan" => Country::bhutan(),
3021            "bolivarianrepublicofvenezuela" => Country::bolivarian_republic_of_venezuela(),
3022            "bolivia" => Country::bolivia(),
3023            "bonaire" => Country::bonaire(),
3024            "bosniaandherzegovina" => Country::bosnia_and_herzegovina(),
3025            "botswana" => Country::botswana(),
3026            "bouvetisland" => Country::bouvet_island(),
3027            "brazil" => Country::brazil(),
3028            "britishindianoceanterritory" => Country::british_indian_ocean_territory(),
3029            "britishvirginislands" => Country::british_virgin_islands(),
3030            "bruneidarussalam" => Country::brunei_darussalam(),
3031            "bulgaria" => Country::bulgaria(),
3032            "burkinafaso" => Country::burkina_faso(),
3033            "burundi" => Country::burundi(),
3034            "caboverde" => Country::cabo_verde(),
3035            "cambodia" => Country::cambodia(),
3036            "cameroon" => Country::cameroon(),
3037            "canada" => Country::canada(),
3038            "chad" => Country::chad(),
3039            "chile" => Country::chile(),
3040            "china" => Country::china(),
3041            "christmasisland" => Country::christmas_island(),
3042            "colombia" => Country::colombia(),
3043            "costarica" => Country::costa_rica(),
3044            "cotedivoire" => Country::coted_ivoire(),
3045            "croatia" => Country::croatia(),
3046            "cuba" => Country::cuba(),
3047            "curacao" => Country::curacao(),
3048            "cyprus" => Country::cyprus(),
3049            "czechia" => Country::czechia(),
3050            "denmark" => Country::denmark(),
3051            "djibouti" => Country::djibouti(),
3052            "dominica" => Country::dominica(),
3053            "dutchpartsintmaarten" => Country::dutch_part_sint_maarten(),
3054            "ecuador" => Country::ecuador(),
3055            "egypt" => Country::egypt(),
3056            "elsalvador" => Country::el_salvador(),
3057            "equatorialguinea" => Country::equatorial_guinea(),
3058            "eritrea" => Country::eritrea(),
3059            "estonia" => Country::estonia(),
3060            "eswatini" => Country::eswatini(),
3061            "ethiopia" => Country::ethiopia(),
3062            "federatedstatesofmicronesia" => Country::federated_states_of_micronesia(),
3063            "fiji" => Country::fiji(),
3064            "finland" => Country::finland(),
3065            "france" => Country::france(),
3066            "frenchguiana" => Country::french_guiana(),
3067            "frenchpartsaintmartin" => Country::french_part_saint_martin(),
3068            "frenchpolynesia" => Country::french_polynesia(),
3069            "gabon" => Country::gabon(),
3070            "georgia" => Country::georgia(),
3071            "germany" => Country::germany(),
3072            "ghana" => Country::ghana(),
3073            "gibraltar" => Country::gibraltar(),
3074            "greece" => Country::greece(),
3075            "greenland" => Country::greenland(),
3076            "grenada" => Country::grenada(),
3077            "guadeloupe" => Country::guadeloupe(),
3078            "guam" => Country::guam(),
3079            "guatemala" => Country::guatemala(),
3080            "guernsey" => Country::guernsey(),
3081            "guinea" => Country::guinea(),
3082            "guineabissau" => Country::guinea_bissau(),
3083            "guyana" => Country::guyana(),
3084            "haiti" => Country::haiti(),
3085            "heardislandandmcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
3086            "honduras" => Country::honduras(),
3087            "hongkong" => Country::hong_kong(),
3088            "hungary" => Country::hungary(),
3089            "iceland" => Country::iceland(),
3090            "india" => Country::india(),
3091            "indonesia" => Country::indonesia(),
3092            "iraq" => Country::iraq(),
3093            "ireland" => Country::ireland(),
3094            "islamicrepublicofiran" => Country::islamic_republic_of_iran(),
3095            "isleofman" => Country::isle_of_man(),
3096            "israel" => Country::israel(),
3097            "italy" => Country::italy(),
3098            "jamaica" => Country::jamaica(),
3099            "japan" => Country::japan(),
3100            "jersey" => Country::jersey(),
3101            "jordan" => Country::jordan(),
3102            "kazakhstan" => Country::kazakhstan(),
3103            "kenya" => Country::kenya(),
3104            "kiribati" => Country::kiribati(),
3105            "kosovo" => Country::kosovo(),
3106            "kuwait" => Country::kuwait(),
3107            "kyrgyzstan" => Country::kyrgyzstan(),
3108            "latvia" => Country::latvia(),
3109            "lebanon" => Country::lebanon(),
3110            "lesotho" => Country::lesotho(),
3111            "liberia" => Country::liberia(),
3112            "libya" => Country::libya(),
3113            "liechtenstein" => Country::liechtenstein(),
3114            "lithuania" => Country::lithuania(),
3115            "luxembourg" => Country::luxembourg(),
3116            "macao" => Country::macao(),
3117            "madagascar" => Country::madagascar(),
3118            "malawi" => Country::malawi(),
3119            "malaysia" => Country::malaysia(),
3120            "maldives" => Country::maldives(),
3121            "mali" => Country::mali(),
3122            "malta" => Country::malta(),
3123            "martinique" => Country::martinique(),
3124            "mauritania" => Country::mauritania(),
3125            "mauritius" => Country::mauritius(),
3126            "mayotte" => Country::mayotte(),
3127            "mexico" => Country::mexico(),
3128            "monaco" => Country::monaco(),
3129            "mongolia" => Country::mongolia(),
3130            "montenegro" => Country::montenegro(),
3131            "montserrat" => Country::montserrat(),
3132            "morocco" => Country::morocco(),
3133            "mozambique" => Country::mozambique(),
3134            "myanmar" => Country::myanmar(),
3135            "namibia" => Country::namibia(),
3136            "nauru" => Country::nauru(),
3137            "nepal" => Country::nepal(),
3138            "newcaledonia" => Country::new_caledonia(),
3139            "newzealand" => Country::new_zealand(),
3140            "nicaragua" => Country::nicaragua(),
3141            "nigeria" => Country::nigeria(),
3142            "niue" => Country::niue(),
3143            "norfolkisland" => Country::norfolk_island(),
3144            "norway" => Country::norway(),
3145            "oman" => Country::oman(),
3146            "pakistan" => Country::pakistan(),
3147            "palau" => Country::palau(),
3148            "panama" => Country::panama(),
3149            "papuanewguinea" => Country::papua_new_guinea(),
3150            "paraguay" => Country::paraguay(),
3151            "peru" => Country::peru(),
3152            "pitcairn" => Country::pitcairn(),
3153            "poland" => Country::poland(),
3154            "portugal" => Country::portugal(),
3155            "puertorico" => Country::puerto_rico(),
3156            "qatar" => Country::qatar(),
3157            "republicofnorthmacedonia" => Country::republic_of_north_macedonia(),
3158            "reunion" => Country::reunion(),
3159            "romania" => Country::romania(),
3160            "rwanda" => Country::rwanda(),
3161            "saintbarthelemy" => Country::saint_barthelemy(),
3162            "saintkittsandnevis" => Country::saint_kitts_and_nevis(),
3163            "saintlucia" => Country::saint_lucia(),
3164            "saintpierreandmiquelon" => Country::saint_pierre_and_miquelon(),
3165            "saintvincentandthegrenadines" => Country::saint_vincent_and_the_grenadines(),
3166            "samoa" => Country::samoa(),
3167            "sanmarino" => Country::san_marino(),
3168            "saotomeandprincipe" => Country::sao_tome_and_principe(),
3169            "saudiarabia" => Country::saudi_arabia(),
3170            "senegal" => Country::senegal(),
3171            "serbia" => Country::serbia(),
3172            "seychelles" => Country::seychelles(),
3173            "sierraleone" => Country::sierra_leone(),
3174            "singapore" => Country::singapore(),
3175            "slovakia" => Country::slovakia(),
3176            "slovenia" => Country::slovenia(),
3177            "solomonislands" => Country::solomon_islands(),
3178            "somalia" => Country::somalia(),
3179            "southafrica" => Country::south_africa(),
3180            "southgeorgiaandthesouthsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
3181            "southsudan" => Country::south_sudan(),
3182            "spain" => Country::spain(),
3183            "srilanka" => Country::sri_lanka(),
3184            "stateofpalestine" => Country::state_of_palestine(),
3185            "suriname" => Country::suriname(),
3186            "svalbardandjanmayen" => Country::svalbard_and_jan_mayen(),
3187            "sweden" => Country::sweden(),
3188            "switzerland" => Country::switzerland(),
3189            "syrianarabrepublic" => Country::syrian_arab_republic(),
3190            "taiwan,republicofchina" => Country::taiwan(),
3191            "tajikistan" => Country::tajikistan(),
3192            "thailand" => Country::thailand(),
3193            "thebahamas" => Country::the_bahamas(),
3194            "thecaymanislands" => Country::the_cayman_islands(),
3195            "thecentralafricanrepublic" => Country::the_central_african_republic(),
3196            "thecocoskeelingislands" => Country::the_cocos_keeling_islands(),
3197            "thecomoros" => Country::the_comoros(),
3198            "thecongo" => Country::the_congo(),
3199            "thecookislands" => Country::the_cook_islands(),
3200            "thedemocraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
3201            "thedemocraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
3202            "thedominicanrepublic" => Country::the_dominican_republic(),
3203            "thefalklandislandsmalvinas" => Country::the_falkland_islands_malvinas(),
3204            "thefaroeislands" => Country::the_faroe_islands(),
3205            "thefrenchsouthernterritories" => Country::the_french_southern_territories(),
3206            "thegambia" => Country::the_gambia(),
3207            "theholysee" => Country::the_holy_see(),
3208            "thelaopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
3209            "themarshallislands" => Country::the_marshall_islands(),
3210            "thenetherlands" => Country::the_netherlands(),
3211            "theniger" => Country::the_niger(),
3212            "thenorthernmarianaislands" => Country::the_northern_mariana_islands(),
3213            "thephilippines" => Country::the_philippines(),
3214            "therepublicofkorea" => Country::the_republic_of_korea(),
3215            "therepublicofmoldova" => Country::the_republic_of_moldova(),
3216            "therussianfederation" => Country::the_russian_federation(),
3217            "thesudan" => Country::the_sudan(),
3218            "theturksandcaicosislands" => Country::the_turks_and_caicos_islands(),
3219            "theunitedarabemirates" => Country::the_united_arab_emirates(),
3220            "theunitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
3221            "theunitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
3222            "theunitedstatesofamerica" => Country::the_united_states_of_america(),
3223            "timorleste" => Country::timor_leste(),
3224            "easttimor" => Country::timor_leste(),
3225            "togo" => Country::togo(),
3226            "tokelau" => Country::tokelau(),
3227            "tonga" => Country::tonga(),
3228            "trinidadandtobago" => Country::trinidad_and_tobago(),
3229            "tunisia" => Country::tunisia(),
3230            "turkey" => Country::turkiye(),
3231            "türkiye" => Country::turkiye(),
3232            "turkmenistan" => Country::turkmenistan(),
3233            "tuvalu" => Country::tuvalu(),
3234            "usvirginislands" => Country::us_virgin_islands(),
3235            "uganda" => Country::uganda(),
3236            "ukraine" => Country::ukraine(),
3237            "unitedrepublicoftanzania" => Country::united_republic_of_tanzania(),
3238            "uruguay" => Country::uruguay(),
3239            "uzbekistan" => Country::uzbekistan(),
3240            "vanuatu" => Country::vanuatu(),
3241            "vietnam" => Country::vietnam(),
3242            "wallisandfutuna" => Country::wallis_and_futuna(),
3243            "westernsahara" => Country::western_sahara(),
3244            "yemen" => Country::yemen(),
3245            "zambia" => Country::zambia(),
3246            "zimbabwe" => Country::zimbabwe(),
3247        };
3248        lookup_ascii_lowercase(&NAMES, name.as_ref())
3249            .copied()
3250            .ok_or("unknown value")
3251    }
3252}
3253
3254impl FromStr for Country {
3255    type Err = &'static str;
3256
3257    #[allow(clippy::too_many_lines)]
3258    fn from_str(code: &str) -> Result<Self, &'static str> {
3259        static CODES: Map<&'static str, Country> = phf_map! {
3260            "afghanistan" => Country::afghanistan(),
3261            "004" => Country::afghanistan(),
3262            "af" => Country::afghanistan(),
3263            "afg" => Country::afghanistan(),
3264            "alandislands" => Country::aland_islands(),
3265            "aland_islands" => Country::aland_islands(),
3266            "248" => Country::aland_islands(),
3267            "ax" => Country::aland_islands(),
3268            "ala" => Country::aland_islands(),
3269            "albania" => Country::albania(),
3270            "008" => Country::albania(),
3271            "al" => Country::albania(),
3272            "alb" => Country::albania(),
3273            "algeria" => Country::algeria(),
3274            "012" => Country::algeria(),
3275            "dz" => Country::algeria(),
3276            "dza" => Country::algeria(),
3277            "americansamoa" => Country::american_samoa(),
3278            "american_samoa" => Country::american_samoa(),
3279            "016" => Country::american_samoa(),
3280            "as" => Country::american_samoa(),
3281            "asm" => Country::american_samoa(),
3282            "andorra" => Country::andorra(),
3283            "020" => Country::andorra(),
3284            "ad" => Country::andorra(),
3285            "and" => Country::andorra(),
3286            "angola" => Country::angola(),
3287            "024" => Country::angola(),
3288            "ao" => Country::angola(),
3289            "ago" => Country::angola(),
3290            "anguilla" => Country::anguilla(),
3291            "660" => Country::anguilla(),
3292            "ai" => Country::anguilla(),
3293            "aia" => Country::anguilla(),
3294            "antarctica" => Country::antarctica(),
3295            "010" => Country::antarctica(),
3296            "aq" => Country::antarctica(),
3297            "ata" => Country::antarctica(),
3298            "antiguaandbarbuda" => Country::antigua_and_barbuda(),
3299            "antigua_and_barbuda" => Country::antigua_and_barbuda(),
3300            "028" => Country::antigua_and_barbuda(),
3301            "ag" => Country::antigua_and_barbuda(),
3302            "atg" => Country::antigua_and_barbuda(),
3303            "argentina" => Country::argentina(),
3304            "032" => Country::argentina(),
3305            "ar" => Country::argentina(),
3306            "arg" => Country::argentina(),
3307            "armenia" => Country::armenia(),
3308            "051" => Country::armenia(),
3309            "am" => Country::armenia(),
3310            "arm" => Country::armenia(),
3311            "aruba" => Country::aruba(),
3312            "533" => Country::aruba(),
3313            "aw" => Country::aruba(),
3314            "abw" => Country::aruba(),
3315            "ascensionandtristandacunhasainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3316            "ascension_and_tristan_da_cunha_saint_helena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3317            "654" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3318            "sh" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3319            "shn" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3320            "sthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3321            "sainthelena" => Country::ascension_and_tristan_da_cunha_saint_helena(),
3322            "australia" => Country::australia(),
3323            "036" => Country::australia(),
3324            "au" => Country::australia(),
3325            "aus" => Country::australia(),
3326            "austria" => Country::austria(),
3327            "040" => Country::austria(),
3328            "at" => Country::austria(),
3329            "aut" => Country::austria(),
3330            "azerbaijan" => Country::azerbaijan(),
3331            "031" => Country::azerbaijan(),
3332            "az" => Country::azerbaijan(),
3333            "aze" => Country::azerbaijan(),
3334            "bahrain" => Country::bahrain(),
3335            "048" => Country::bahrain(),
3336            "bh" => Country::bahrain(),
3337            "bhr" => Country::bahrain(),
3338            "bangladesh" => Country::bangladesh(),
3339            "050" => Country::bangladesh(),
3340            "bd" => Country::bangladesh(),
3341            "bgd" => Country::bangladesh(),
3342            "barbados" => Country::barbados(),
3343            "052" => Country::barbados(),
3344            "bb" => Country::barbados(),
3345            "brb" => Country::barbados(),
3346            "belarus" => Country::belarus(),
3347            "112" => Country::belarus(),
3348            "by" => Country::belarus(),
3349            "blr" => Country::belarus(),
3350            "belgium" => Country::belgium(),
3351            "056" => Country::belgium(),
3352            "be" => Country::belgium(),
3353            "bel" => Country::belgium(),
3354            "belize" => Country::belize(),
3355            "084" => Country::belize(),
3356            "bz" => Country::belize(),
3357            "blz" => Country::belize(),
3358            "benin" => Country::benin(),
3359            "204" => Country::benin(),
3360            "bj" => Country::benin(),
3361            "ben" => Country::benin(),
3362            "bermuda" => Country::bermuda(),
3363            "060" => Country::bermuda(),
3364            "bm" => Country::bermuda(),
3365            "bmu" => Country::bermuda(),
3366            "bhutan" => Country::bhutan(),
3367            "064" => Country::bhutan(),
3368            "bt" => Country::bhutan(),
3369            "btn" => Country::bhutan(),
3370            "bolivarianrepublicofvenezuela" => Country::bolivarian_republic_of_venezuela(),
3371            "bolivarian_republic_of_venezuela" => Country::bolivarian_republic_of_venezuela(),
3372            "862" => Country::bolivarian_republic_of_venezuela(),
3373            "ve" => Country::bolivarian_republic_of_venezuela(),
3374            "ven" => Country::bolivarian_republic_of_venezuela(),
3375            "venezuela" => Country::bolivarian_republic_of_venezuela(),
3376            "bolivia" => Country::bolivia(),
3377            "068" => Country::bolivia(),
3378            "bo" => Country::bolivia(),
3379            "bol" => Country::bolivia(),
3380            "bonaire" => Country::bonaire(),
3381            "535" => Country::bonaire(),
3382            "bq" => Country::bonaire(),
3383            "bes" => Country::bonaire(),
3384            "bosniaandherzegovina" => Country::bosnia_and_herzegovina(),
3385            "bosnia_and_herzegovina" => Country::bosnia_and_herzegovina(),
3386            "070" => Country::bosnia_and_herzegovina(),
3387            "ba" => Country::bosnia_and_herzegovina(),
3388            "bih" => Country::bosnia_and_herzegovina(),
3389            "bosnia" => Country::bosnia_and_herzegovina(),
3390            "herzegovina" => Country::bosnia_and_herzegovina(),
3391            "botswana" => Country::botswana(),
3392            "072" => Country::botswana(),
3393            "bw" => Country::botswana(),
3394            "bwa" => Country::botswana(),
3395            "bouvetisland" => Country::bouvet_island(),
3396            "bouvet_island" => Country::bouvet_island(),
3397            "074" => Country::bouvet_island(),
3398            "bv" => Country::bouvet_island(),
3399            "bvt" => Country::bouvet_island(),
3400            "brazil" => Country::brazil(),
3401            "076" => Country::brazil(),
3402            "br" => Country::brazil(),
3403            "bra" => Country::brazil(),
3404            "britishindianoceanterritory" => Country::british_indian_ocean_territory(),
3405            "british_indian_ocean_territory" => Country::british_indian_ocean_territory(),
3406            "086" => Country::british_indian_ocean_territory(),
3407            "io" => Country::british_indian_ocean_territory(),
3408            "iot" => Country::british_indian_ocean_territory(),
3409            "britishvirginislands" => Country::british_virgin_islands(),
3410            "british_virgin_islands" => Country::british_virgin_islands(),
3411            "092" => Country::british_virgin_islands(),
3412            "vg" => Country::british_virgin_islands(),
3413            "vgb" => Country::british_virgin_islands(),
3414            "bruneidarussalam" => Country::brunei_darussalam(),
3415            "brunei_darussalam" => Country::brunei_darussalam(),
3416            "096" => Country::brunei_darussalam(),
3417            "bn" => Country::brunei_darussalam(),
3418            "brn" => Country::brunei_darussalam(),
3419            "brunei" => Country::brunei_darussalam(),
3420            "bulgaria" => Country::bulgaria(),
3421            "100" => Country::bulgaria(),
3422            "bg" => Country::bulgaria(),
3423            "bgr" => Country::bulgaria(),
3424            "burkinafaso" => Country::burkina_faso(),
3425            "burkina_faso" => Country::burkina_faso(),
3426            "854" => Country::burkina_faso(),
3427            "bf" => Country::burkina_faso(),
3428            "bfa" => Country::burkina_faso(),
3429            "burkina" => Country::burkina_faso(),
3430            "burundi" => Country::burundi(),
3431            "108" => Country::burundi(),
3432            "bi" => Country::burundi(),
3433            "bdi" => Country::burundi(),
3434            "caboverde" => Country::cabo_verde(),
3435            "cabo_verde" => Country::cabo_verde(),
3436            "132" => Country::cabo_verde(),
3437            "cv" => Country::cabo_verde(),
3438            "cpv" => Country::cabo_verde(),
3439            "capeverde" => Country::cabo_verde(),
3440            "cape_verde" => Country::cabo_verde(),
3441            "cambodia" => Country::cambodia(),
3442            "116" => Country::cambodia(),
3443            "kh" => Country::cambodia(),
3444            "khm" => Country::cambodia(),
3445            "cameroon" => Country::cameroon(),
3446            "120" => Country::cameroon(),
3447            "cm" => Country::cameroon(),
3448            "cmr" => Country::cameroon(),
3449            "canada" => Country::canada(),
3450            "124" => Country::canada(),
3451            "ca" => Country::canada(),
3452            "can" => Country::canada(),
3453            "chad" => Country::chad(),
3454            "148" => Country::chad(),
3455            "td" => Country::chad(),
3456            "tcd" => Country::chad(),
3457            "chile" => Country::chile(),
3458            "152" => Country::chile(),
3459            "cl" => Country::chile(),
3460            "chl" => Country::chile(),
3461            "china" => Country::china(),
3462            "156" => Country::china(),
3463            "cn" => Country::china(),
3464            "chn" => Country::china(),
3465            "christmasisland" => Country::christmas_island(),
3466            "christmas_island" => Country::christmas_island(),
3467            "162" => Country::christmas_island(),
3468            "cx" => Country::christmas_island(),
3469            "cxr" => Country::christmas_island(),
3470            "colombia" => Country::colombia(),
3471            "170" => Country::colombia(),
3472            "co" => Country::colombia(),
3473            "col" => Country::colombia(),
3474            "costarica" => Country::costa_rica(),
3475            "costa_rica" => Country::costa_rica(),
3476            "188" => Country::costa_rica(),
3477            "cr" => Country::costa_rica(),
3478            "cri" => Country::costa_rica(),
3479            "cotedivoire" => Country::coted_ivoire(),
3480            "coted_ivoire" => Country::coted_ivoire(),
3481            "384" => Country::coted_ivoire(),
3482            "ci" => Country::coted_ivoire(),
3483            "civ" => Country::coted_ivoire(),
3484            "ivorycoast" => Country::coted_ivoire(),
3485            "ivory_coast" => Country::coted_ivoire(),
3486            "croatia" => Country::croatia(),
3487            "191" => Country::croatia(),
3488            "hr" => Country::croatia(),
3489            "hrv" => Country::croatia(),
3490            "cuba" => Country::cuba(),
3491            "192" => Country::cuba(),
3492            "cu" => Country::cuba(),
3493            "cub" => Country::cuba(),
3494            "curacao" => Country::curacao(),
3495            "531" => Country::curacao(),
3496            "cw" => Country::curacao(),
3497            "cuw" => Country::curacao(),
3498            "cyprus" => Country::cyprus(),
3499            "196" => Country::cyprus(),
3500            "cy" => Country::cyprus(),
3501            "cyp" => Country::cyprus(),
3502            "czechia" => Country::czechia(),
3503            "czechrepublic" => Country::czechia(),
3504            "203" => Country::czechia(),
3505            "cz" => Country::czechia(),
3506            "cze" => Country::czechia(),
3507            "denmark" => Country::denmark(),
3508            "208" => Country::denmark(),
3509            "dk" => Country::denmark(),
3510            "dnk" => Country::denmark(),
3511            "djibouti" => Country::djibouti(),
3512            "262" => Country::djibouti(),
3513            "dj" => Country::djibouti(),
3514            "dji" => Country::djibouti(),
3515            "dominica" => Country::dominica(),
3516            "212" => Country::dominica(),
3517            "dm" => Country::dominica(),
3518            "dma" => Country::dominica(),
3519            "dutchpartsintmaarten" => Country::dutch_part_sint_maarten(),
3520            "dutch_part_sint_maarten" => Country::dutch_part_sint_maarten(),
3521            "534" => Country::dutch_part_sint_maarten(),
3522            "sx" => Country::dutch_part_sint_maarten(),
3523            "sxm" => Country::dutch_part_sint_maarten(),
3524            "stmaarten" => Country::dutch_part_sint_maarten(),
3525            "sintmaarten" => Country::dutch_part_sint_maarten(),
3526            "ecuador" => Country::ecuador(),
3527            "218" => Country::ecuador(),
3528            "ec" => Country::ecuador(),
3529            "ecu" => Country::ecuador(),
3530            "egypt" => Country::egypt(),
3531            "818" => Country::egypt(),
3532            "eg" => Country::egypt(),
3533            "egy" => Country::egypt(),
3534            "elsalvador" => Country::el_salvador(),
3535            "el_salvador" => Country::el_salvador(),
3536            "222" => Country::el_salvador(),
3537            "sv" => Country::el_salvador(),
3538            "slv" => Country::el_salvador(),
3539            "equatorialguinea" => Country::equatorial_guinea(),
3540            "equatorial_guinea" => Country::equatorial_guinea(),
3541            "226" => Country::equatorial_guinea(),
3542            "gq" => Country::equatorial_guinea(),
3543            "gnq" => Country::equatorial_guinea(),
3544            "eritrea" => Country::eritrea(),
3545            "232" => Country::eritrea(),
3546            "er" => Country::eritrea(),
3547            "eri" => Country::eritrea(),
3548            "estonia" => Country::estonia(),
3549            "233" => Country::estonia(),
3550            "ee" => Country::estonia(),
3551            "est" => Country::estonia(),
3552            "eswatini" => Country::eswatini(),
3553            "748" => Country::eswatini(),
3554            "sz" => Country::eswatini(),
3555            "swz" => Country::eswatini(),
3556            "swaziland" => Country::eswatini(),
3557            "ethiopia" => Country::ethiopia(),
3558            "231" => Country::ethiopia(),
3559            "et" => Country::ethiopia(),
3560            "eth" => Country::ethiopia(),
3561            "federatedstatesofmicronesia" => Country::federated_states_of_micronesia(),
3562            "federated_states_of_micronesia" => Country::federated_states_of_micronesia(),
3563            "583" => Country::federated_states_of_micronesia(),
3564            "fm" => Country::federated_states_of_micronesia(),
3565            "fsm" => Country::federated_states_of_micronesia(),
3566            "micronesia" => Country::federated_states_of_micronesia(),
3567            "fiji" => Country::fiji(),
3568            "242" => Country::fiji(),
3569            "fj" => Country::fiji(),
3570            "fji" => Country::fiji(),
3571            "finland" => Country::finland(),
3572            "246" => Country::finland(),
3573            "fi" => Country::finland(),
3574            "fin" => Country::finland(),
3575            "france" => Country::france(),
3576            "250" => Country::france(),
3577            "fr" => Country::france(),
3578            "fra" => Country::france(),
3579            "frenchguiana" => Country::french_guiana(),
3580            "french_guiana" => Country::french_guiana(),
3581            "254" => Country::french_guiana(),
3582            "gf" => Country::french_guiana(),
3583            "guf" => Country::french_guiana(),
3584            "frenchpartsaintmartin" => Country::french_part_saint_martin(),
3585            "french_part_saint_martin" => Country::french_part_saint_martin(),
3586            "663" => Country::french_part_saint_martin(),
3587            "mf" => Country::french_part_saint_martin(),
3588            "maf" => Country::french_part_saint_martin(),
3589            "stmartin" => Country::french_part_saint_martin(),
3590            "saintmartin" => Country::french_part_saint_martin(),
3591            "frenchpolynesia" => Country::french_polynesia(),
3592            "258" => Country::french_polynesia(),
3593            "pf" => Country::french_polynesia(),
3594            "pyf" => Country::french_polynesia(),
3595            "gabon" => Country::gabon(),
3596            "266" => Country::gabon(),
3597            "ga" => Country::gabon(),
3598            "gab" => Country::gabon(),
3599            "georgia" => Country::georgia(),
3600            "268" => Country::georgia(),
3601            "ge" => Country::georgia(),
3602            "geo" => Country::georgia(),
3603            "germany" => Country::germany(),
3604            "276" => Country::germany(),
3605            "de" => Country::germany(),
3606            "deu" => Country::germany(),
3607            "ghana" => Country::ghana(),
3608            "288" => Country::ghana(),
3609            "gh" => Country::ghana(),
3610            "gha" => Country::ghana(),
3611            "gibraltar" => Country::gibraltar(),
3612            "292" => Country::gibraltar(),
3613            "gi" => Country::gibraltar(),
3614            "gib" => Country::gibraltar(),
3615            "greece" => Country::greece(),
3616            "300" => Country::greece(),
3617            "gr" => Country::greece(),
3618            "grc" => Country::greece(),
3619            "greenland" => Country::greenland(),
3620            "304" => Country::greenland(),
3621            "gl" => Country::greenland(),
3622            "grl" => Country::greenland(),
3623            "grenada" => Country::grenada(),
3624            "308" => Country::grenada(),
3625            "gd" => Country::grenada(),
3626            "grd" => Country::grenada(),
3627            "guadeloupe" => Country::guadeloupe(),
3628            "312" => Country::guadeloupe(),
3629            "gp" => Country::guadeloupe(),
3630            "glp" => Country::guadeloupe(),
3631            "guam" => Country::guam(),
3632            "316" => Country::guam(),
3633            "gu" => Country::guam(),
3634            "gum" => Country::guam(),
3635            "guatemala" => Country::guatemala(),
3636            "320" => Country::guatemala(),
3637            "gt" => Country::guatemala(),
3638            "gtm" => Country::guatemala(),
3639            "guernsey" => Country::guernsey(),
3640            "831" => Country::guernsey(),
3641            "gg" => Country::guernsey(),
3642            "ggy" => Country::guernsey(),
3643            "guinea" => Country::guinea(),
3644            "324" => Country::guinea(),
3645            "gn" => Country::guinea(),
3646            "gin" => Country::guinea(),
3647            "guineabissau" => Country::guinea_bissau(),
3648            "guinea_bissau" => Country::guinea_bissau(),
3649            "624" => Country::guinea_bissau(),
3650            "gw" => Country::guinea_bissau(),
3651            "gnb" => Country::guinea_bissau(),
3652            "guyana" => Country::guyana(),
3653            "328" => Country::guyana(),
3654            "gy" => Country::guyana(),
3655            "guy" => Country::guyana(),
3656            "haiti" => Country::haiti(),
3657            "332" => Country::haiti(),
3658            "ht" => Country::haiti(),
3659            "hti" => Country::haiti(),
3660            "heardislandandmcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
3661            "heard_island_and_mc_donald_islands" => Country::heard_island_and_mc_donald_islands(),
3662            "334" => Country::heard_island_and_mc_donald_islands(),
3663            "hm" => Country::heard_island_and_mc_donald_islands(),
3664            "hmd" => Country::heard_island_and_mc_donald_islands(),
3665            "heardisland" => Country::heard_island_and_mc_donald_islands(),
3666            "mcdonaldislands" => Country::heard_island_and_mc_donald_islands(),
3667            "honduras" => Country::honduras(),
3668            "340" => Country::honduras(),
3669            "hn" => Country::honduras(),
3670            "hnd" => Country::honduras(),
3671            "hongkong" => Country::hong_kong(),
3672            "hong_kong" => Country::hong_kong(),
3673            "344" => Country::hong_kong(),
3674            "hk" => Country::hong_kong(),
3675            "hkg" => Country::hong_kong(),
3676            "hungary" => Country::hungary(),
3677            "348" => Country::hungary(),
3678            "hu" => Country::hungary(),
3679            "hun" => Country::hungary(),
3680            "iceland" => Country::iceland(),
3681            "352" => Country::iceland(),
3682            "is" => Country::iceland(),
3683            "isl" => Country::iceland(),
3684            "india" => Country::india(),
3685            "356" => Country::india(),
3686            "in" => Country::india(),
3687            "ind" => Country::india(),
3688            "indonesia" => Country::indonesia(),
3689            "360" => Country::indonesia(),
3690            "id" => Country::indonesia(),
3691            "idn" => Country::indonesia(),
3692            "iraq" => Country::iraq(),
3693            "368" => Country::iraq(),
3694            "iq" => Country::iraq(),
3695            "irq" => Country::iraq(),
3696            "ireland" => Country::ireland(),
3697            "372" => Country::ireland(),
3698            "ie" => Country::ireland(),
3699            "irl" => Country::ireland(),
3700            "islamicrepublicofiran" => Country::islamic_republic_of_iran(),
3701            "islamic_republic_of_iran" => Country::islamic_republic_of_iran(),
3702            "364" => Country::islamic_republic_of_iran(),
3703            "ir" => Country::islamic_republic_of_iran(),
3704            "irn" => Country::islamic_republic_of_iran(),
3705            "iran" => Country::islamic_republic_of_iran(),
3706            "isleofman" => Country::isle_of_man(),
3707            "isle_of_man" => Country::isle_of_man(),
3708            "833" => Country::isle_of_man(),
3709            "im" => Country::isle_of_man(),
3710            "imn" => Country::isle_of_man(),
3711            "israel" => Country::israel(),
3712            "376" => Country::israel(),
3713            "il" => Country::israel(),
3714            "isr" => Country::israel(),
3715            "italy" => Country::italy(),
3716            "380" => Country::italy(),
3717            "it" => Country::italy(),
3718            "ita" => Country::italy(),
3719            "jamaica" => Country::jamaica(),
3720            "388" => Country::jamaica(),
3721            "jm" => Country::jamaica(),
3722            "jam" => Country::jamaica(),
3723            "japan" => Country::japan(),
3724            "392" => Country::japan(),
3725            "jp" => Country::japan(),
3726            "jpn" => Country::japan(),
3727            "jersey" => Country::jersey(),
3728            "832" => Country::jersey(),
3729            "je" => Country::jersey(),
3730            "jey" => Country::jersey(),
3731            "jordan" => Country::jordan(),
3732            "400" => Country::jordan(),
3733            "jo" => Country::jordan(),
3734            "jor" => Country::jordan(),
3735            "kazakhstan" => Country::kazakhstan(),
3736            "398" => Country::kazakhstan(),
3737            "kz" => Country::kazakhstan(),
3738            "kaz" => Country::kazakhstan(),
3739            "kenya" => Country::kenya(),
3740            "404" => Country::kenya(),
3741            "ke" => Country::kenya(),
3742            "ken" => Country::kenya(),
3743            "kiribati" => Country::kiribati(),
3744            "296" => Country::kiribati(),
3745            "ki" => Country::kiribati(),
3746            "kir" => Country::kiribati(),
3747            "kosovo" => Country::kosovo(),
3748            "383" => Country::kosovo(),
3749            "xk" => Country::kosovo(),
3750            "xkx" => Country::kosovo(),
3751            "kuwait" => Country::kuwait(),
3752            "414" => Country::kuwait(),
3753            "kw" => Country::kuwait(),
3754            "kwt" => Country::kuwait(),
3755            "kyrgyzstan" => Country::kyrgyzstan(),
3756            "417" => Country::kyrgyzstan(),
3757            "kg" => Country::kyrgyzstan(),
3758            "kgz" => Country::kyrgyzstan(),
3759            "latvia" => Country::latvia(),
3760            "428" => Country::latvia(),
3761            "lv" => Country::latvia(),
3762            "lva" => Country::latvia(),
3763            "lebanon" => Country::lebanon(),
3764            "422" => Country::lebanon(),
3765            "lb" => Country::lebanon(),
3766            "lbn" => Country::lebanon(),
3767            "lesotho" => Country::lesotho(),
3768            "426" => Country::lesotho(),
3769            "ls" => Country::lesotho(),
3770            "lso" => Country::lesotho(),
3771            "liberia" => Country::liberia(),
3772            "430" => Country::liberia(),
3773            "lr" => Country::liberia(),
3774            "lbr" => Country::liberia(),
3775            "libya" => Country::libya(),
3776            "434" => Country::libya(),
3777            "ly" => Country::libya(),
3778            "lby" => Country::libya(),
3779            "liechtenstein" => Country::liechtenstein(),
3780            "438" => Country::liechtenstein(),
3781            "li" => Country::liechtenstein(),
3782            "lie" => Country::liechtenstein(),
3783            "lithuania" => Country::lithuania(),
3784            "440" => Country::lithuania(),
3785            "lt" => Country::lithuania(),
3786            "ltu" => Country::lithuania(),
3787            "luxembourg" => Country::luxembourg(),
3788            "442" => Country::luxembourg(),
3789            "lu" => Country::luxembourg(),
3790            "lux" => Country::luxembourg(),
3791            "macao" => Country::macao(),
3792            "446" => Country::macao(),
3793            "mo" => Country::macao(),
3794            "mac" => Country::macao(),
3795            "macau" => Country::macao(),
3796            "madagascar" => Country::madagascar(),
3797            "450" => Country::madagascar(),
3798            "mg" => Country::madagascar(),
3799            "mdg" => Country::madagascar(),
3800            "malawi" => Country::malawi(),
3801            "454" => Country::malawi(),
3802            "mw" => Country::malawi(),
3803            "mwi" => Country::malawi(),
3804            "malaysia" => Country::malaysia(),
3805            "458" => Country::malaysia(),
3806            "my" => Country::malaysia(),
3807            "mys" => Country::malaysia(),
3808            "maldives" => Country::maldives(),
3809            "462" => Country::maldives(),
3810            "mv" => Country::maldives(),
3811            "mdv" => Country::maldives(),
3812            "mali" => Country::mali(),
3813            "466" => Country::mali(),
3814            "ml" => Country::mali(),
3815            "mli" => Country::mali(),
3816            "malta" => Country::malta(),
3817            "470" => Country::malta(),
3818            "mt" => Country::malta(),
3819            "mlt" => Country::malta(),
3820            "martinique" => Country::martinique(),
3821            "474" => Country::martinique(),
3822            "mq" => Country::martinique(),
3823            "mtq" => Country::martinique(),
3824            "mauritania" => Country::mauritania(),
3825            "478" => Country::mauritania(),
3826            "mr" => Country::mauritania(),
3827            "mrt" => Country::mauritania(),
3828            "mauritius" => Country::mauritius(),
3829            "480" => Country::mauritius(),
3830            "mu" => Country::mauritius(),
3831            "mus" => Country::mauritius(),
3832            "mayotte" => Country::mayotte(),
3833            "175" => Country::mayotte(),
3834            "yt" => Country::mayotte(),
3835            "myt" => Country::mayotte(),
3836            "mexico" => Country::mexico(),
3837            "484" => Country::mexico(),
3838            "mx" => Country::mexico(),
3839            "mex" => Country::mexico(),
3840            "monaco" => Country::monaco(),
3841            "492" => Country::monaco(),
3842            "mc" => Country::monaco(),
3843            "mco" => Country::monaco(),
3844            "mongolia" => Country::mongolia(),
3845            "496" => Country::mongolia(),
3846            "mn" => Country::mongolia(),
3847            "mng" => Country::mongolia(),
3848            "montenegro" => Country::montenegro(),
3849            "499" => Country::montenegro(),
3850            "me" => Country::montenegro(),
3851            "mne" => Country::montenegro(),
3852            "montserrat" => Country::montserrat(),
3853            "500" => Country::montserrat(),
3854            "ms" => Country::montserrat(),
3855            "msr" => Country::montserrat(),
3856            "morocco" => Country::morocco(),
3857            "504" => Country::morocco(),
3858            "ma" => Country::morocco(),
3859            "mar" => Country::morocco(),
3860            "mozambique" => Country::mozambique(),
3861            "508" => Country::mozambique(),
3862            "mz" => Country::mozambique(),
3863            "moz" => Country::mozambique(),
3864            "myanmar" => Country::myanmar(),
3865            "104" => Country::myanmar(),
3866            "mm" => Country::myanmar(),
3867            "mmr" => Country::myanmar(),
3868            "burma" => Country::myanmar(),
3869            "namibia" => Country::namibia(),
3870            "516" => Country::namibia(),
3871            "na" => Country::namibia(),
3872            "nam" => Country::namibia(),
3873            "nauru" => Country::nauru(),
3874            "520" => Country::nauru(),
3875            "nr" => Country::nauru(),
3876            "nru" => Country::nauru(),
3877            "nepal" => Country::nepal(),
3878            "524" => Country::nepal(),
3879            "np" => Country::nepal(),
3880            "npl" => Country::nepal(),
3881            "newcaledonia" => Country::new_caledonia(),
3882            "new_caledonia" => Country::new_caledonia(),
3883            "540" => Country::new_caledonia(),
3884            "nc" => Country::new_caledonia(),
3885            "ncl" => Country::new_caledonia(),
3886            "newzealand" => Country::new_zealand(),
3887            "new_zealand" => Country::new_zealand(),
3888            "554" => Country::new_zealand(),
3889            "nz" => Country::new_zealand(),
3890            "nzl" => Country::new_zealand(),
3891            "nicaragua" => Country::nicaragua(),
3892            "558" => Country::nicaragua(),
3893            "ni" => Country::nicaragua(),
3894            "nic" => Country::nicaragua(),
3895            "nigeria" => Country::nigeria(),
3896            "566" => Country::nigeria(),
3897            "ng" => Country::nigeria(),
3898            "nga" => Country::nigeria(),
3899            "niue" => Country::niue(),
3900            "570" => Country::niue(),
3901            "nu" => Country::niue(),
3902            "niu" => Country::niue(),
3903            "norfolkisland" => Country::norfolk_island(),
3904            "norfolk_island" => Country::norfolk_island(),
3905            "574" => Country::norfolk_island(),
3906            "nf" => Country::norfolk_island(),
3907            "nfk" => Country::norfolk_island(),
3908            "norway" => Country::norway(),
3909            "578" => Country::norway(),
3910            "no" => Country::norway(),
3911            "nor" => Country::norway(),
3912            "oman" => Country::oman(),
3913            "512" => Country::oman(),
3914            "om" => Country::oman(),
3915            "omn" => Country::oman(),
3916            "pakistan" => Country::pakistan(),
3917            "586" => Country::pakistan(),
3918            "pk" => Country::pakistan(),
3919            "pak" => Country::pakistan(),
3920            "palau" => Country::palau(),
3921            "585" => Country::palau(),
3922            "pw" => Country::palau(),
3923            "plw" => Country::palau(),
3924            "panama" => Country::panama(),
3925            "591" => Country::panama(),
3926            "pa" => Country::panama(),
3927            "pan" => Country::panama(),
3928            "papuanewguinea" => Country::papua_new_guinea(),
3929            "papua_new_guinea" => Country::papua_new_guinea(),
3930            "598" => Country::papua_new_guinea(),
3931            "pg" => Country::papua_new_guinea(),
3932            "png" => Country::papua_new_guinea(),
3933            "paraguay" => Country::paraguay(),
3934            "600" => Country::paraguay(),
3935            "py" => Country::paraguay(),
3936            "pry" => Country::paraguay(),
3937            "peru" => Country::peru(),
3938            "604" => Country::peru(),
3939            "pe" => Country::peru(),
3940            "per" => Country::peru(),
3941            "pitcairn" => Country::pitcairn(),
3942            "612" => Country::pitcairn(),
3943            "pn" => Country::pitcairn(),
3944            "pcn" => Country::pitcairn(),
3945            "poland" => Country::poland(),
3946            "616" => Country::poland(),
3947            "pl" => Country::poland(),
3948            "pol" => Country::poland(),
3949            "portugal" => Country::portugal(),
3950            "620" => Country::portugal(),
3951            "pt" => Country::portugal(),
3952            "prt" => Country::portugal(),
3953            "puertorico" => Country::puerto_rico(),
3954            "puerto_rico" => Country::puerto_rico(),
3955            "630" => Country::puerto_rico(),
3956            "pr" => Country::puerto_rico(),
3957            "pri" => Country::puerto_rico(),
3958            "qatar" => Country::qatar(),
3959            "634" => Country::qatar(),
3960            "qa" => Country::qatar(),
3961            "qat" => Country::qatar(),
3962            "republicofnorthmacedonia" => Country::republic_of_north_macedonia(),
3963            "republic_of_north_macedonia" => Country::republic_of_north_macedonia(),
3964            "807" => Country::republic_of_north_macedonia(),
3965            "mk" => Country::republic_of_north_macedonia(),
3966            "mkd" => Country::republic_of_north_macedonia(),
3967            "macedonia" => Country::republic_of_north_macedonia(),
3968            "reunion" => Country::reunion(),
3969            "638" => Country::reunion(),
3970            "re" => Country::reunion(),
3971            "reu" => Country::reunion(),
3972            "romania" => Country::romania(),
3973            "642" => Country::romania(),
3974            "ro" => Country::romania(),
3975            "rou" => Country::romania(),
3976            "rwanda" => Country::rwanda(),
3977            "646" => Country::rwanda(),
3978            "rw" => Country::rwanda(),
3979            "rwa" => Country::rwanda(),
3980            "saintbarthelemy" => Country::saint_barthelemy(),
3981            "saint_barthelemy" => Country::saint_barthelemy(),
3982            "652" => Country::saint_barthelemy(),
3983            "bl" => Country::saint_barthelemy(),
3984            "blm" => Country::saint_barthelemy(),
3985            "stbarthelemy" => Country::saint_barthelemy(),
3986            "saintkittsandnevis" => Country::saint_kitts_and_nevis(),
3987            "saint_kitts_and_nevis" => Country::saint_kitts_and_nevis(),
3988            "659" => Country::saint_kitts_and_nevis(),
3989            "kn" => Country::saint_kitts_and_nevis(),
3990            "kna" => Country::saint_kitts_and_nevis(),
3991            "stkitts" => Country::saint_kitts_and_nevis(),
3992            "saintlucia" => Country::saint_lucia(),
3993            "saint_lucia" => Country::saint_lucia(),
3994            "662" => Country::saint_lucia(),
3995            "lc" => Country::saint_lucia(),
3996            "lca" => Country::saint_lucia(),
3997            "stlucia" => Country::saint_lucia(),
3998            "saintpierreandmiquelon" => Country::saint_pierre_and_miquelon(),
3999            "saint_pierre_and_miquelon" => Country::saint_pierre_and_miquelon(),
4000            "666" => Country::saint_pierre_and_miquelon(),
4001            "pm" => Country::saint_pierre_and_miquelon(),
4002            "spm" => Country::saint_pierre_and_miquelon(),
4003            "stpierre" => Country::saint_pierre_and_miquelon(),
4004            "saintpierre" => Country::saint_pierre_and_miquelon(),
4005            "saintvincentandthegrenadines" => Country::saint_vincent_and_the_grenadines(),
4006            "saint_vincent_and_the_grenadines" => Country::saint_vincent_and_the_grenadines(),
4007            "670" => Country::saint_vincent_and_the_grenadines(),
4008            "vc" => Country::saint_vincent_and_the_grenadines(),
4009            "vct" => Country::saint_vincent_and_the_grenadines(),
4010            "stvincent" => Country::saint_vincent_and_the_grenadines(),
4011            "saintvincent" => Country::saint_vincent_and_the_grenadines(),
4012            "samoa" => Country::samoa(),
4013            "882" => Country::samoa(),
4014            "ws" => Country::samoa(),
4015            "wsm" => Country::samoa(),
4016            "sanmarino" => Country::san_marino(),
4017            "san_marino" => Country::san_marino(),
4018            "674" => Country::san_marino(),
4019            "sm" => Country::san_marino(),
4020            "smr" => Country::san_marino(),
4021            "saotomeandprincipe" => Country::sao_tome_and_principe(),
4022            "sao_tome_and_principe" => Country::sao_tome_and_principe(),
4023            "678" => Country::sao_tome_and_principe(),
4024            "st" => Country::sao_tome_and_principe(),
4025            "stp" => Country::sao_tome_and_principe(),
4026            "saotome" => Country::sao_tome_and_principe(),
4027            "saudiarabia" => Country::saudi_arabia(),
4028            "saudi_arabia" => Country::saudi_arabia(),
4029            "682" => Country::saudi_arabia(),
4030            "sa" => Country::saudi_arabia(),
4031            "sau" => Country::saudi_arabia(),
4032            "senegal" => Country::senegal(),
4033            "686" => Country::senegal(),
4034            "sn" => Country::senegal(),
4035            "sen" => Country::senegal(),
4036            "serbia" => Country::serbia(),
4037            "688" => Country::serbia(),
4038            "rs" => Country::serbia(),
4039            "srb" => Country::serbia(),
4040            "seychelles" => Country::seychelles(),
4041            "690" => Country::seychelles(),
4042            "sc" => Country::seychelles(),
4043            "syc" => Country::seychelles(),
4044            "sierraleone" => Country::sierra_leone(),
4045            "sierra_leone" => Country::sierra_leone(),
4046            "694" => Country::sierra_leone(),
4047            "sl" => Country::sierra_leone(),
4048            "sle" => Country::sierra_leone(),
4049            "singapore" => Country::singapore(),
4050            "702" => Country::singapore(),
4051            "sg" => Country::singapore(),
4052            "sgp" => Country::singapore(),
4053            "slovakia" => Country::slovakia(),
4054            "703" => Country::slovakia(),
4055            "sk" => Country::slovakia(),
4056            "svk" => Country::slovakia(),
4057            "slovenia" => Country::slovenia(),
4058            "705" => Country::slovenia(),
4059            "si" => Country::slovenia(),
4060            "svn" => Country::slovenia(),
4061            "solomonislands" => Country::solomon_islands(),
4062            "solomon_islands" => Country::solomon_islands(),
4063            "090" => Country::solomon_islands(),
4064            "sb" => Country::solomon_islands(),
4065            "slb" => Country::solomon_islands(),
4066            "somalia" => Country::somalia(),
4067            "706" => Country::somalia(),
4068            "so" => Country::somalia(),
4069            "som" => Country::somalia(),
4070            "southafrica" => Country::south_africa(),
4071            "south_africa" => Country::south_africa(),
4072            "710" => Country::south_africa(),
4073            "za" => Country::south_africa(),
4074            "zaf" => Country::south_africa(),
4075            "southgeorgiaandthesouthsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
4076            "south_georgia_and_the_south_sandwich_islands" => Country::south_georgia_and_the_south_sandwich_islands(),
4077            "239" => Country::south_georgia_and_the_south_sandwich_islands(),
4078            "gs" => Country::south_georgia_and_the_south_sandwich_islands(),
4079            "sgs" => Country::south_georgia_and_the_south_sandwich_islands(),
4080            "southgeorgia" => Country::south_georgia_and_the_south_sandwich_islands(),
4081            "southsandwichislands" => Country::south_georgia_and_the_south_sandwich_islands(),
4082            "southsudan" => Country::south_sudan(),
4083            "south_sudan" => Country::south_sudan(),
4084            "728" => Country::south_sudan(),
4085            "ss" => Country::south_sudan(),
4086            "ssd" => Country::south_sudan(),
4087            "spain" => Country::spain(),
4088            "724" => Country::spain(),
4089            "es" => Country::spain(),
4090            "esp" => Country::spain(),
4091            "srilanka" => Country::sri_lanka(),
4092            "sri_lanka" => Country::sri_lanka(),
4093            "144" => Country::sri_lanka(),
4094            "lk" => Country::sri_lanka(),
4095            "lka" => Country::sri_lanka(),
4096            "stateofpalestine" => Country::state_of_palestine(),
4097            "state_of_palestine" => Country::state_of_palestine(),
4098            "275" => Country::state_of_palestine(),
4099            "ps" => Country::state_of_palestine(),
4100            "pse" => Country::state_of_palestine(),
4101            "palestine" => Country::state_of_palestine(),
4102            "suriname" => Country::suriname(),
4103            "740" => Country::suriname(),
4104            "sr" => Country::suriname(),
4105            "sur" => Country::suriname(),
4106            "svalbardandjanmayen" => Country::svalbard_and_jan_mayen(),
4107            "svalbard_and_jan_mayen" => Country::svalbard_and_jan_mayen(),
4108            "744" => Country::svalbard_and_jan_mayen(),
4109            "sj" => Country::svalbard_and_jan_mayen(),
4110            "sjm" => Country::svalbard_and_jan_mayen(),
4111            "sweden" => Country::sweden(),
4112            "752" => Country::sweden(),
4113            "se" => Country::sweden(),
4114            "swe" => Country::sweden(),
4115            "switzerland" => Country::switzerland(),
4116            "756" => Country::switzerland(),
4117            "ch" => Country::switzerland(),
4118            "che" => Country::switzerland(),
4119            "syrianarabrepublic" => Country::syrian_arab_republic(),
4120            "syrian_arab_republic" => Country::syrian_arab_republic(),
4121            "760" => Country::syrian_arab_republic(),
4122            "sy" => Country::syrian_arab_republic(),
4123            "syr" => Country::syrian_arab_republic(),
4124            "syria" => Country::syrian_arab_republic(),
4125            "taiwan,republicofchina" => Country::taiwan(),
4126            "taiwan" => Country::taiwan(),
4127            "158" => Country::taiwan(),
4128            "tw" => Country::taiwan(),
4129            "twn" => Country::taiwan(),
4130            "tajikistan" => Country::tajikistan(),
4131            "762" => Country::tajikistan(),
4132            "tj" => Country::tajikistan(),
4133            "tjk" => Country::tajikistan(),
4134            "thailand" => Country::thailand(),
4135            "764" => Country::thailand(),
4136            "th" => Country::thailand(),
4137            "tha" => Country::thailand(),
4138            "thebahamas" => Country::the_bahamas(),
4139            "the_bahamas" => Country::the_bahamas(),
4140            "044" => Country::the_bahamas(),
4141            "bs" => Country::the_bahamas(),
4142            "bhs" => Country::the_bahamas(),
4143            "bahamas" => Country::the_bahamas(),
4144            "thecaymanislands" => Country::the_cayman_islands(),
4145            "the_cayman_islands" => Country::the_cayman_islands(),
4146            "136" => Country::the_cayman_islands(),
4147            "ky" => Country::the_cayman_islands(),
4148            "cym" => Country::the_cayman_islands(),
4149            "caymanislands" => Country::the_cayman_islands(),
4150            "thecentralafricanrepublic" => Country::the_central_african_republic(),
4151            "the_central_african_republic" => Country::the_central_african_republic(),
4152            "140" => Country::the_central_african_republic(),
4153            "cf" => Country::the_central_african_republic(),
4154            "caf" => Country::the_central_african_republic(),
4155            "centralafricanrepublic" => Country::the_central_african_republic(),
4156            "thecocoskeelingislands" => Country::the_cocos_keeling_islands(),
4157            "the_cocos_keeling_islands" => Country::the_cocos_keeling_islands(),
4158            "166" => Country::the_cocos_keeling_islands(),
4159            "cc" => Country::the_cocos_keeling_islands(),
4160            "cck" => Country::the_cocos_keeling_islands(),
4161            "cocosislands" => Country::the_cocos_keeling_islands(),
4162            "keelingislands" => Country::the_cocos_keeling_islands(),
4163            "thecomoros" => Country::the_comoros(),
4164            "the_comoros" => Country::the_comoros(),
4165            "174" => Country::the_comoros(),
4166            "km" => Country::the_comoros(),
4167            "com" => Country::the_comoros(),
4168            "comoros" => Country::the_comoros(),
4169            "thecongo" => Country::the_congo(),
4170            "the_congo" => Country::the_congo(),
4171            "178" => Country::the_congo(),
4172            "cg" => Country::the_congo(),
4173            "cog" => Country::the_congo(),
4174            "congo" => Country::the_congo(),
4175            "thecookislands" => Country::the_cook_islands(),
4176            "the_cook_islands" => Country::the_cook_islands(),
4177            "184" => Country::the_cook_islands(),
4178            "ck" => Country::the_cook_islands(),
4179            "cok" => Country::the_cook_islands(),
4180            "cookislands" => Country::the_cook_islands(),
4181            "thedemocraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
4182            "the_democratic_peoples_republic_of_korea" => Country::the_democratic_peoples_republic_of_korea(),
4183            "408" => Country::the_democratic_peoples_republic_of_korea(),
4184            "kp" => Country::the_democratic_peoples_republic_of_korea(),
4185            "prk" => Country::the_democratic_peoples_republic_of_korea(),
4186            "northkorea" => Country::the_democratic_peoples_republic_of_korea(),
4187            "democraticpeoplesrepublicofkorea" => Country::the_democratic_peoples_republic_of_korea(),
4188            "thedemocraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
4189            "the_democratic_republic_of_the_congo" => Country::the_democratic_republic_of_the_congo(),
4190            "180" => Country::the_democratic_republic_of_the_congo(),
4191            "cd" => Country::the_democratic_republic_of_the_congo(),
4192            "cod" => Country::the_democratic_republic_of_the_congo(),
4193            "democraticrepublicofthecongo" => Country::the_democratic_republic_of_the_congo(),
4194            "thedominicanrepublic" => Country::the_dominican_republic(),
4195            "the_dominican_republic" => Country::the_dominican_republic(),
4196            "214" => Country::the_dominican_republic(),
4197            "do" => Country::the_dominican_republic(),
4198            "dom" => Country::the_dominican_republic(),
4199            "dominicanrepublic" => Country::the_dominican_republic(),
4200            "thefalklandislandsmalvinas" => Country::the_falkland_islands_malvinas(),
4201            "the_falkland_islands_malvinas" => Country::the_falkland_islands_malvinas(),
4202            "238" => Country::the_falkland_islands_malvinas(),
4203            "fk" => Country::the_falkland_islands_malvinas(),
4204            "flk" => Country::the_falkland_islands_malvinas(),
4205            "malvinas" => Country::the_falkland_islands_malvinas(),
4206            "falklandislands" => Country::the_falkland_islands_malvinas(),
4207            "thefaroeislands" => Country::the_faroe_islands(),
4208            "the_faroe_islands" => Country::the_faroe_islands(),
4209            "234" => Country::the_faroe_islands(),
4210            "fo" => Country::the_faroe_islands(),
4211            "fro" => Country::the_faroe_islands(),
4212            "faroeislands" => Country::the_faroe_islands(),
4213            "thefrenchsouthernterritories" => Country::the_french_southern_territories(),
4214            "the_french_southern_territories" => Country::the_french_southern_territories(),
4215            "260" => Country::the_french_southern_territories(),
4216            "tf" => Country::the_french_southern_territories(),
4217            "atf" => Country::the_french_southern_territories(),
4218            "frenchsouthernterritories" => Country::the_french_southern_territories(),
4219            "thegambia" => Country::the_gambia(),
4220            "the_gambia" => Country::the_gambia(),
4221            "270" => Country::the_gambia(),
4222            "gm" => Country::the_gambia(),
4223            "gmb" => Country::the_gambia(),
4224            "gambia" => Country::the_gambia(),
4225            "theholysee" => Country::the_holy_see(),
4226            "the_holy_see" => Country::the_holy_see(),
4227            "336" => Country::the_holy_see(),
4228            "va" => Country::the_holy_see(),
4229            "vat" => Country::the_holy_see(),
4230            "holysee" => Country::the_holy_see(),
4231            "vatican" => Country::the_holy_see(),
4232            "vaticancity" => Country::the_holy_see(),
4233            "vatican_city" => Country::the_holy_see(),
4234            "thelaopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
4235            "the_lao_peoples_democratic_republic" => Country::the_lao_peoples_democratic_republic(),
4236            "418" => Country::the_lao_peoples_democratic_republic(),
4237            "la" => Country::the_lao_peoples_democratic_republic(),
4238            "lao" => Country::the_lao_peoples_democratic_republic(),
4239            "laopeoplesdemocraticrepublic" => Country::the_lao_peoples_democratic_republic(),
4240            "laos" => Country::the_lao_peoples_democratic_republic(),
4241            "themarshallislands" => Country::the_marshall_islands(),
4242            "the_marshall_islands" => Country::the_marshall_islands(),
4243            "584" => Country::the_marshall_islands(),
4244            "mh" => Country::the_marshall_islands(),
4245            "mhl" => Country::the_marshall_islands(),
4246            "marshallislands" => Country::the_marshall_islands(),
4247            "thenetherlands" => Country::the_netherlands(),
4248            "the_netherlands" => Country::the_netherlands(),
4249            "528" => Country::the_netherlands(),
4250            "nl" => Country::the_netherlands(),
4251            "nld" => Country::the_netherlands(),
4252            "netherlands" => Country::the_netherlands(),
4253            "holland" => Country::the_netherlands(),
4254            "theniger" => Country::the_niger(),
4255            "the_niger" => Country::the_niger(),
4256            "562" => Country::the_niger(),
4257            "ne" => Country::the_niger(),
4258            "ner" => Country::the_niger(),
4259            "niger" => Country::the_niger(),
4260            "thenorthernmarianaislands" => Country::the_northern_mariana_islands(),
4261            "the_northern_mariana_islands" => Country::the_northern_mariana_islands(),
4262            "580" => Country::the_northern_mariana_islands(),
4263            "mp" => Country::the_northern_mariana_islands(),
4264            "mnp" => Country::the_northern_mariana_islands(),
4265            "northernmarianaislands" => Country::the_northern_mariana_islands(),
4266            "thephilippines" => Country::the_philippines(),
4267            "the_philippines" => Country::the_philippines(),
4268            "608" => Country::the_philippines(),
4269            "ph" => Country::the_philippines(),
4270            "phl" => Country::the_philippines(),
4271            "philippines" => Country::the_philippines(),
4272            "therepublicofkorea" => Country::the_republic_of_korea(),
4273            "the_republic_of_korea" => Country::the_republic_of_korea(),
4274            "410" => Country::the_republic_of_korea(),
4275            "kr" => Country::the_republic_of_korea(),
4276            "kor" => Country::the_republic_of_korea(),
4277            "southkorea" => Country::the_republic_of_korea(),
4278            "republicofkorea" => Country::the_republic_of_korea(),
4279            "therepublicofmoldova" => Country::the_republic_of_moldova(),
4280            "the_republic_of_moldova" => Country::the_republic_of_moldova(),
4281            "498" => Country::the_republic_of_moldova(),
4282            "md" => Country::the_republic_of_moldova(),
4283            "mda" => Country::the_republic_of_moldova(),
4284            "moldova" => Country::the_republic_of_moldova(),
4285            "republicofmoldova" => Country::the_republic_of_moldova(),
4286            "therussianfederation" => Country::the_russian_federation(),
4287            "the_russian_federation" => Country::the_russian_federation(),
4288            "643" => Country::the_russian_federation(),
4289            "ru" => Country::the_russian_federation(),
4290            "rus" => Country::the_russian_federation(),
4291            "russia" => Country::the_russian_federation(),
4292            "russianfederation" => Country::the_russian_federation(),
4293            "thesudan" => Country::the_sudan(),
4294            "the_sudan" => Country::the_sudan(),
4295            "729" => Country::the_sudan(),
4296            "sd" => Country::the_sudan(),
4297            "sdn" => Country::the_sudan(),
4298            "sudan" => Country::the_sudan(),
4299            "theturksandcaicosislands" => Country::the_turks_and_caicos_islands(),
4300            "the_turks_and_caicos_islands" => Country::the_turks_and_caicos_islands(),
4301            "796" => Country::the_turks_and_caicos_islands(),
4302            "tc" => Country::the_turks_and_caicos_islands(),
4303            "tca" => Country::the_turks_and_caicos_islands(),
4304            "turksandcaicosislands" => Country::the_turks_and_caicos_islands(),
4305            "theunitedarabemirates" => Country::the_united_arab_emirates(),
4306            "the_united_arab_emirates" => Country::the_united_arab_emirates(),
4307            "784" => Country::the_united_arab_emirates(),
4308            "ae" => Country::the_united_arab_emirates(),
4309            "are" => Country::the_united_arab_emirates(),
4310            "unitedarabemirates" => Country::the_united_arab_emirates(),
4311            "theunitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4312            "the_united_kingdom_of_great_britain_and_northern_ireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4313            "826" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4314            "gb" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4315            "gbr" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4316            "england" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4317            "scotland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4318            "greatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4319            "unitedkingdom" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4320            "northernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4321            "unitedkingdomofgreatbritain" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4322            "unitedkingdomofgreatbritainandnorthernireland" => Country::the_united_kingdom_of_great_britain_and_northern_ireland(),
4323            "theunitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
4324            "the_united_states_minor_outlying_islands" => Country::the_united_states_minor_outlying_islands(),
4325            "581" => Country::the_united_states_minor_outlying_islands(),
4326            "um" => Country::the_united_states_minor_outlying_islands(),
4327            "umi" => Country::the_united_states_minor_outlying_islands(),
4328            "unitedstatesminoroutlyingislands" => Country::the_united_states_minor_outlying_islands(),
4329            "theunitedstatesofamerica" => Country::the_united_states_of_america(),
4330            "the_united_states_of_america" => Country::the_united_states_of_america(),
4331            "840" => Country::the_united_states_of_america(),
4332            "us" => Country::the_united_states_of_america(),
4333            "usa" => Country::the_united_states_of_america(),
4334            "america" => Country::the_united_states_of_america(),
4335            "united states" => Country::the_united_states_of_america(),
4336            "unitedstates" => Country::the_united_states_of_america(),
4337            "unitedstatesofamerica" => Country::the_united_states_of_america(),
4338            "united_states_of_america" => Country::the_united_states_of_america(),
4339            "timorleste" => Country::timor_leste(),
4340            "timor_leste" => Country::timor_leste(),
4341            "626" => Country::timor_leste(),
4342            "tl" => Country::timor_leste(),
4343            "tls" => Country::timor_leste(),
4344            "togo" => Country::togo(),
4345            "768" => Country::togo(),
4346            "tg" => Country::togo(),
4347            "tgo" => Country::togo(),
4348            "tokelau" => Country::tokelau(),
4349            "772" => Country::tokelau(),
4350            "tk" => Country::tokelau(),
4351            "tkl" => Country::tokelau(),
4352            "tonga" => Country::tonga(),
4353            "776" => Country::tonga(),
4354            "to" => Country::tonga(),
4355            "ton" => Country::tonga(),
4356            "trinidadandtobago" => Country::trinidad_and_tobago(),
4357            "trinidad_and_tobago" => Country::trinidad_and_tobago(),
4358            "780" => Country::trinidad_and_tobago(),
4359            "tt" => Country::trinidad_and_tobago(),
4360            "tto" => Country::trinidad_and_tobago(),
4361            "trinidad" => Country::trinidad_and_tobago(),
4362            "tobago" => Country::trinidad_and_tobago(),
4363            "tunisia" => Country::tunisia(),
4364            "788" => Country::tunisia(),
4365            "tn" => Country::tunisia(),
4366            "tun" => Country::tunisia(),
4367            "turkey" => Country::turkiye(),
4368            "türkiye" => Country::turkiye(),
4369            "792" => Country::turkiye(),
4370            "tr" => Country::turkiye(),
4371            "tur" => Country::turkiye(),
4372            "turkmenistan" => Country::turkmenistan(),
4373            "795" => Country::turkmenistan(),
4374            "tm" => Country::turkmenistan(),
4375            "tkm" => Country::turkmenistan(),
4376            "tuvalu" => Country::tuvalu(),
4377            "798" => Country::tuvalu(),
4378            "tv" => Country::tuvalu(),
4379            "tuv" => Country::tuvalu(),
4380            "usvirginislands" => Country::us_virgin_islands(),
4381            "us_virgin_islands" => Country::us_virgin_islands(),
4382            "850" => Country::us_virgin_islands(),
4383            "vi" => Country::us_virgin_islands(),
4384            "vir" => Country::us_virgin_islands(),
4385            "uganda" => Country::uganda(),
4386            "800" => Country::uganda(),
4387            "ug" => Country::uganda(),
4388            "uga" => Country::uganda(),
4389            "ukraine" => Country::ukraine(),
4390            "804" => Country::ukraine(),
4391            "ua" => Country::ukraine(),
4392            "ukr" => Country::ukraine(),
4393            "unitedrepublicoftanzania" => Country::united_republic_of_tanzania(),
4394            "united_republic_of_tanzania" => Country::united_republic_of_tanzania(),
4395            "834" => Country::united_republic_of_tanzania(),
4396            "tz" => Country::united_republic_of_tanzania(),
4397            "tza" => Country::united_republic_of_tanzania(),
4398            "tanzania" => Country::united_republic_of_tanzania(),
4399            "uruguay" => Country::uruguay(),
4400            "858" => Country::uruguay(),
4401            "uy" => Country::uruguay(),
4402            "ury" => Country::uruguay(),
4403            "uzbekistan" => Country::uzbekistan(),
4404            "860" => Country::uzbekistan(),
4405            "uz" => Country::uzbekistan(),
4406            "uzb" => Country::uzbekistan(),
4407            "vanuatu" => Country::vanuatu(),
4408            "548" => Country::vanuatu(),
4409            "vu" => Country::vanuatu(),
4410            "vut" => Country::vanuatu(),
4411            "vietnam" => Country::vietnam(),
4412            "704" => Country::vietnam(),
4413            "vn" => Country::vietnam(),
4414            "vnm" => Country::vietnam(),
4415            "wallisandfutuna" => Country::wallis_and_futuna(),
4416            "wallis_and_futuna" => Country::wallis_and_futuna(),
4417            "876" => Country::wallis_and_futuna(),
4418            "wf" => Country::wallis_and_futuna(),
4419            "wlf" => Country::wallis_and_futuna(),
4420            "westernsahara" => Country::western_sahara(),
4421            "western_sahara" => Country::western_sahara(),
4422            "732" => Country::western_sahara(),
4423            "eh" => Country::western_sahara(),
4424            "esh" => Country::western_sahara(),
4425            "yemen" => Country::yemen(),
4426            "887" => Country::yemen(),
4427            "ye" => Country::yemen(),
4428            "yem" => Country::yemen(),
4429            "zambia" => Country::zambia(),
4430            "894" => Country::zambia(),
4431            "zm" => Country::zambia(),
4432            "zmb" => Country::zambia(),
4433            "zimbabwe" => Country::zimbabwe(),
4434            "716" => Country::zimbabwe(),
4435            "zw" => Country::zimbabwe(),
4436            "zwe" => Country::zimbabwe(),
4437        };
4438        lookup_ascii_lowercase(&CODES, code)
4439            .copied()
4440            .ok_or("unknown value")
4441    }
4442}