├── .gitignore ├── Cargo.toml ├── src ├── bin │ └── main.rs ├── iso3166_3.rs └── lib.rs ├── scripts ├── iso3166_3.data ├── iso3166_2.py ├── iso3166_3.py └── lib.py └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | .idea -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust_iso3166" 3 | version = "0.1.14" 4 | edition = "2021" 5 | description="ISO 3166-1 (Codes for the representation of names of countries and their subdivisions – Part 1: Country codes) is a standard defining codes for the names of countries, dependent territories, and special areas of geographical interest. It is the first part of the ISO 3166 standard published by the International Organization for Standardization." 6 | repository="https://github.com/rust-iso/rust_iso3166" 7 | license="Apache-2.0" 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | exclude = ["src/*.py"] 10 | documentation = "https://docs.rs/rust_iso3166/" 11 | keywords=["ISO3166", "ISO3166-1", "ISO3166-2", "ISO3166-3"] 12 | 13 | [lib] 14 | crate-type = ["cdylib", "rlib"] 15 | 16 | [dependencies] 17 | phf = { version = "^0.11.1", features = ["macros"] } 18 | 19 | [target.'cfg(not(target_arch = "wasm32"))'.dependencies] 20 | prettytable-rs = "^0.10" 21 | 22 | [target.'cfg(target_arch = "wasm32")'.dependencies] 23 | wasm-bindgen = "^0.2.83" 24 | js-sys = "^0.3.60" 25 | 26 | [target.'cfg(target_arch = "wasm32")'.dev-dependencies] 27 | wasm-bindgen-test = "^0.3.33" 28 | -------------------------------------------------------------------------------- /src/bin/main.rs: -------------------------------------------------------------------------------- 1 | #[cfg(not(target_arch = "wasm32"))] 2 | fn main() { 3 | use prettytable::{row, Table}; 4 | use std::env; 5 | 6 | let mut args = env::args(); 7 | let script_name = match args.next() { 8 | Some(arg) => arg, 9 | None => String::from(""), 10 | }; 11 | let query = match args.next() { 12 | Some(arg) => arg, 13 | None => String::from(""), 14 | }; 15 | let query = &query.to_lowercase(); 16 | 17 | eprintln!("Usage: {} [query]", script_name); 18 | let mut found = false; 19 | let mut table = Table::new(); 20 | table.add_row(row!["Name", "Alpha2", "Alpha3", "Numeric"]); 21 | 22 | for country in rust_iso3166::ALL { 23 | if country.alpha2.to_lowercase().contains(query) 24 | || country.alpha3.to_lowercase().contains(query) 25 | || country.numeric_str().to_lowercase().contains(query) 26 | { 27 | table.add_row(row![ 28 | country.name, 29 | country.alpha2, 30 | country.alpha3, 31 | country.numeric_str() 32 | ]); 33 | found = true; 34 | } 35 | } 36 | 37 | if !found { 38 | for country in rust_iso3166::ALL { 39 | if country.name.to_lowercase().contains(query) { 40 | table.add_row(row![ 41 | country.name, 42 | country.alpha2, 43 | country.alpha3, 44 | country.numeric_str() 45 | ]); 46 | } 47 | } 48 | } 49 | table.printstd(); 50 | } 51 | 52 | #[cfg(target_arch = "wasm32")] 53 | fn main() { 54 | unimplemented!(); 55 | } 56 | -------------------------------------------------------------------------------- /scripts/iso3166_3.data: -------------------------------------------------------------------------------- 1 | Former country name,Former codes,Period of validity,ISO 3166-3 code,New country names and codes 2 | British Antarctic Territory,"BQ, ATB, -",1974–1979,BQAQ,"Merged into Antarctica (AQ, ATA, 010)" 3 | Burma,"BU, BUR, 104",1974–1989,BUMM,"Name changed to Myanmar (MM, MMR, 104)" 4 | Byelorussian SSR,"BY, BYS, 112",1974–1992,BYAA,"Name changed to Belarus (BY, BLR, 112)" 5 | Canton and Enderbury Islands,"CT, CTE, 128",1974–1984,CTKI,"Merged into Kiribati (KI, KIR, 296)" 6 | Czechoslovakia,"CS, CSK, 200",1974–1993,CSHH,"Divided into: 7 | Czechia (CZ, CZE, 203) 8 | Slovakia (SK, SVK, 703)" 9 | Dahomey,"DY, DHY, 204",1974–1977,DYBJ,"Name changed to Benin (BJ, BEN, 204)" 10 | Dronning Maud Land,"NQ, ATN, 216",1974–1983,NQAQ,"Merged into Antarctica (AQ, ATA, 010)" 11 | East Timor[note 1],"TP, TMP, 626",1974–2002,TPTL,"Name changed to Timor-Leste (TL, TLS, 626)" 12 | "France, Metropolitan","FX, FXX, 249",1993–1997,FXFR,"Merged into France (FR, FRA, 250)" 13 | French Afars and Issas,"AI, AFI, 262",1974–1977,AIDJ,"Name changed to Djibouti (DJ, DJI, 262)" 14 | French Southern and Antarctic Territories,"FQ, ATF, -",1974–1979,FQHH,"Divided into: 15 | Part of Antarctica (AQ, ATA, 010) (i.e., Adélie Land) 16 | French Southern Territories (TF, ATF, 260)" 17 | German Democratic Republic,"DD, DDR, 278",1974–1990,DDDE,"Merged into Germany (DE, DEU, 276)" 18 | Gilbert Islands[note 2],"GE, GEL, 296",1974–1979,GEHH,"Name changed to Kiribati (KI, KIR, 296)" 19 | Johnston Island,"JT, JTN, 396",1974–1986,JTUM,"Merged into United States Minor Outlying Islands (UM, UMI, 581)" 20 | Midway Islands,"MI, MID, 488",1974–1986,MIUM,"Merged into United States Minor Outlying Islands (UM, UMI, 581)" 21 | Netherlands Antilles,"AN, ANT, 530 22 | [note 3]",1974–2010 [note 4],ANHH,"Divided into: 23 | Bonaire, Sint Eustatius and Saba (BQ, BES, 535) [note 5] 24 | Curaçao (CW, CUW, 531) 25 | Sint Maarten (Dutch part) (SX, SXM, 534)" 26 | Neutral Zone,"NT, NTZ, 536",1974–1993,NTHH,"Divided into: 27 | Part of Iraq (IQ, IRQ, 368) 28 | Part of Saudi Arabia (SA, SAU, 682)" 29 | New Hebrides,"NH, NHB, 548",1974–1980,NHVU,"Name changed to Vanuatu (VU, VUT, 548)" 30 | Pacific Islands (Trust Territory),"PC, PCI, 582",1974–1986,PCHH,"Divided into: 31 | Marshall Islands (MH, MHL, 584) 32 | Micronesia (Federated States of) (FM, FSM, 583) 33 | Northern Mariana Islands (MP, MNP, 580) 34 | Palau (PW, PLW, 585)" 35 | Panama Canal Zone,"PZ, PCZ, -",1974–1980,PZPA,"Merged into Panama (PA, PAN, 591)" 36 | Serbia and Montenegro,"CS, SCG, 891",2003–2006,"CSXX 37 | [note 6]","Divided into: 38 | Montenegro (ME, MNE, 499) 39 | Serbia (RS, SRB, 688)" 40 | Sikkim,"SK, SKM, -",1974–1975,SKIN,"Merged into India (IN, IND, 356)" 41 | Southern Rhodesia,"RH, RHO, 716",1974–1980,RHZW,"Name changed to Zimbabwe (ZW, ZWE, 716)" 42 | United States Miscellaneous Pacific Islands,"PU, PUS, 849",1974–1986,PUUM,"Merged into United States Minor Outlying Islands (UM, UMI, 581)" 43 | Upper Volta,"HV, HVO, 854",1974–1984,HVBF,"Name changed to Burkina Faso (BF, BFA, 854)" 44 | USSR,"SU, SUN, 810",1974–1992,SUHH,"Divided into: [note 7] 45 | Armenia (AM, ARM, 051) 46 | Azerbaijan (AZ, AZE, 031) 47 | Estonia (EE, EST, 233) 48 | Georgia (GE, GEO, 268) 49 | Kazakhstan (KZ, KAZ, 398) 50 | Kyrgyzstan (KG, KGZ, 417) 51 | Latvia (LV, LVA, 428) 52 | Lithuania (LT, LTU, 440) 53 | Moldova, Republic of (MD, MDA, 498) 54 | Russian Federation (RU, RUS, 643) 55 | Tajikistan (TJ, TJK, 762) 56 | Turkmenistan (TM, TKM, 795) 57 | Uzbekistan (UZ, UZB, 860)" 58 | "Viet-Nam, Democratic Republic of","VD, VDR, -",1974–1977,VDVN,"Merged into Viet Nam (VN, VNM, 704)" 59 | Wake Island,"WK, WAK, 872",1974–1986,WKUM,"Merged into United States Minor Outlying Islands (UM, UMI, 581)" 60 | "Yemen, Democratic","YD, YMD, 720",1974–1990,YDYE,"Merged into Yemen (YE, YEM, 887)" 61 | Yugoslavia,"YU, YUG, 891 62 | [note 8]",1974–2003,YUCS,"Name changed to Serbia and Montenegro (CS, SCG, 891)" 63 | Zaire,"ZR, ZAR, 180",1974–1997,ZRCD,"Name changed to Congo, Democratic Republic of the (CD, COD, 180)" 64 | -------------------------------------------------------------------------------- /scripts/iso3166_2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import csv 4 | 5 | pre_code = """ 6 | use phf::phf_map; 7 | use phf::Map; 8 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 9 | use wasm_bindgen::prelude::*; 10 | 11 | /// # Sample code 12 | /// ``` 13 | /// let country = rust_iso3166::from_alpha2("GB").unwrap(); 14 | /// let subdivisions = country.subdivisions(); 15 | /// assert!(subdivisions.unwrap().len() > 0); 16 | /// let country = rust_iso3166::iso3166_2::from_code("GB-EDH"); 17 | /// assert_eq!("Edinburgh, City of", country.unwrap().name); 18 | /// println!("{:?}", rust_iso3166::iso3166_2::SUBDIVISION_COUNTRY_MAP); 19 | /// println!("{:?}", rust_iso3166::iso3166_2::SUBDIVISION_MAP); 20 | /// ``` 21 | 22 | /// Data for each Country Code defined by ISO 3166-2 23 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 24 | #[wasm_bindgen] 25 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 26 | pub struct Subdivision { 27 | ///Name 28 | name: &'static str, 29 | ///Subdivision Type 30 | subdivision_type: &'static str, 31 | ///Code 32 | code: &'static str, 33 | ///Country Name 34 | country_name: &'static str, 35 | ///Country Code 36 | country_code: &'static str, 37 | ///Region Code 38 | region_code: &'static str, 39 | } 40 | 41 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 42 | #[wasm_bindgen] 43 | impl Subdivision { 44 | #[wasm_bindgen(getter)] 45 | pub fn name(&self) -> String { 46 | self.name.into() 47 | } 48 | 49 | #[wasm_bindgen(getter)] 50 | pub fn code(&self) -> String { 51 | self.code.into() 52 | } 53 | 54 | #[wasm_bindgen(getter)] 55 | pub fn subdivision_type(&self) -> String { 56 | self.subdivision_type.into() 57 | } 58 | 59 | #[wasm_bindgen(getter)] 60 | pub fn country_name(&self) -> String { 61 | self.country_name.into() 62 | } 63 | 64 | #[wasm_bindgen(getter)] 65 | pub fn country_code(&self) -> String { 66 | self.country_code.into() 67 | } 68 | 69 | #[wasm_bindgen(getter)] 70 | pub fn region_code(&self) -> String { 71 | self.region_code.into() 72 | } 73 | } 74 | 75 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 76 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 77 | pub struct Subdivision { 78 | ///Name 79 | pub name: &'static str, 80 | ///Subdivision Type 81 | pub subdivision_type: &'static str, 82 | ///Code 83 | pub code: &'static str, 84 | ///Country Name 85 | pub country_name: &'static str, 86 | ///Country Code 87 | pub country_code: &'static str, 88 | ///Region Code 89 | pub region_code: &'static str, 90 | } 91 | 92 | /// Returns the Subdivision with the given code, if exists. 93 | /// #Sample 94 | /// ``` 95 | /// let sub = rust_iso3166::iso3166_2::from_code("SE-O"); 96 | /// assert_eq!("Västra Götalands län", sub.unwrap().name); 97 | /// ``` 98 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen(js_name = from_code_iso_3166_2))] 99 | pub fn from_code(code: &str) -> Option { 100 | SUBDIVISION_MAP.get(code).cloned() 101 | } 102 | """ 103 | print(pre_code) 104 | f = csv.reader(open("iso3166_2.data", "r"), delimiter=",", quotechar='"') 105 | subdivisions = {} 106 | for x in f: 107 | ts1 = x[1].split("-") 108 | region_code = ts1[1] 109 | country_code = x[4] 110 | country_name = x[0] 111 | sub_name = x[2] 112 | sub_code = x[1] 113 | sub_type = x[3] 114 | var_name = sub_code.replace("-", "_") 115 | 116 | if not country_code in subdivisions: 117 | subdivisions[country_code] = [] 118 | subdivisions[country_code].append( 119 | { 120 | "name": sub_name, 121 | "var_name": var_name, 122 | "code": sub_code, 123 | "type": sub_type, 124 | "country_name": country_name, 125 | "country_code": country_code, 126 | "region_code": region_code, 127 | } 128 | ) 129 | print( 130 | """pub const %s: Subdivision = Subdivision { 131 | name: "%s", 132 | code: "%s", 133 | subdivision_type: "%s", 134 | country_name: "%s", 135 | country_code: "%s", 136 | region_code: "%s", 137 | }; 138 | """ 139 | % ( 140 | var_name, 141 | sub_name, 142 | sub_code, 143 | sub_type, 144 | country_name, 145 | country_code, 146 | region_code, 147 | ) 148 | ) 149 | 150 | 151 | print( 152 | """ 153 | ///Subdivision map with Code key 154 | pub const SUBDIVISION_MAP: Map<&str, Subdivision> = phf_map! { 155 | """ 156 | ) 157 | for key in subdivisions: 158 | for sub in subdivisions[key]: 159 | print('"%s" => %s,' % (sub["code"], sub["var_name"])) 160 | print( 161 | """ 162 | }; 163 | """ 164 | ) 165 | 166 | print( 167 | """ 168 | ///Subdivision map with Code key 169 | pub const SUBDIVISION_COUNTRY_MAP: Map<&str, &[Subdivision]> = phf_map! { 170 | """ 171 | ) 172 | for key in subdivisions: 173 | print('"%s" => &[' % (key)) 174 | for sub in subdivisions[key]: 175 | print("%s," % (sub["var_name"])) 176 | print("],") 177 | print( 178 | """ 179 | }; 180 | """ 181 | ) 182 | -------------------------------------------------------------------------------- /scripts/iso3166_3.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import csv 4 | import re 5 | 6 | pre_code = """ 7 | use phf::phf_map; 8 | use phf::Map; 9 | use crate::CountryCode; 10 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 11 | use wasm_bindgen::prelude::*; 12 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 13 | use js_sys::Array; 14 | 15 | /// Data for each Country Code defined by ISO 3166-1 16 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 17 | #[wasm_bindgen] 18 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 19 | pub struct CountryCode3 { 20 | ///ISO 3166-3 code 21 | code: &'static str, 22 | ///Former country name 23 | name: &'static str, 24 | 25 | former: CountryCode, 26 | new_countries: &'static [CountryCode], 27 | 28 | ///Period of validity 29 | validity: &'static [i32], 30 | ///Decription 31 | desc: &'static str, 32 | 33 | } 34 | 35 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 36 | #[wasm_bindgen] 37 | impl CountryCode3 { 38 | #[wasm_bindgen(getter)] 39 | pub fn code(&self) -> String { 40 | self.code.into() 41 | } 42 | 43 | #[wasm_bindgen(getter)] 44 | pub fn name(&self) -> String { 45 | self.name.into() 46 | } 47 | 48 | #[wasm_bindgen(getter)] 49 | pub fn former(&self) -> CountryCode { 50 | self.former 51 | } 52 | 53 | #[wasm_bindgen(getter)] 54 | pub fn new_countries(&self) -> Array { 55 | let mut vector: Vec = Vec::new(); 56 | // self.individual_languages.into_serde().unwrap(); 57 | for i in 0..self.new_countries.len() { 58 | vector.push(self.new_countries[i]) 59 | } 60 | vector.into_iter().map(JsValue::from).collect() 61 | } 62 | 63 | #[wasm_bindgen(getter)] 64 | pub fn desc(&self) -> String { 65 | self.desc.into() 66 | } 67 | } 68 | 69 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 70 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 71 | pub struct CountryCode3 { 72 | ///ISO 3166-3 code 73 | pub code: &'static str, 74 | ///Former country name 75 | pub name: &'static str, 76 | 77 | pub former: CountryCode, 78 | pub new_countries: &'static [CountryCode], 79 | 80 | ///Period of validity 81 | pub validity: &'static [i32], 82 | ///Decription 83 | pub desc: &'static str, 84 | 85 | } 86 | """ 87 | 88 | f = csv.reader(open("iso3166_3.data", "r"), delimiter=",", quotechar='"') 89 | 90 | print(pre_code) 91 | 92 | codes = [] 93 | line = 0 94 | for x in f: 95 | line = line + 1 96 | if line == 1: 97 | continue 98 | 99 | code = x[3].strip() 100 | code = re.sub(r"\[note.*?\]", "", code).strip() 101 | name = re.sub(r"\[note.*?\]", "", x[0].strip()) 102 | former = x[1].strip().split(",") 103 | # former = re.sub(r"\[note.*?\]","",former) 104 | 105 | former_alpha2 = former[0].strip() 106 | former_alpha3 = former[1].strip() 107 | former_numeric = former[2].strip() 108 | former_numeric = re.sub(r"\[note.*?\]", "", former_numeric).strip() 109 | if former_numeric == "-": 110 | former_numeric = "0" 111 | 112 | former_numeric = str(int(former_numeric)) 113 | 114 | validity = x[2].split("\xe2\x80\x93") 115 | validity = x[2].split("–") 116 | validity_from = re.sub(r"\[note.*?\]", "", validity[0]) 117 | validity_to = re.sub(r"\[note.*?\]", "", validity[1]) 118 | 119 | desc = re.sub(r"\(.*?\)", "", x[4]) 120 | desc = re.sub(r"\[note.*?\]", "", desc).replace("\n", "") 121 | # print x 122 | # print validity 123 | codes.append(code) 124 | print( 125 | """ 126 | pub const %s: CountryCode3 = CountryCode3 { 127 | code: "%s", 128 | name: "%s", 129 | former: CountryCode { 130 | name: "%s", 131 | alpha2: "%s", 132 | alpha3: "%s", 133 | numeric: %s, 134 | }, 135 | validity: &[%s,%s], 136 | desc: "%s", 137 | new_countries: &[ 138 | """ 139 | % ( 140 | code, 141 | code, 142 | name, 143 | name, 144 | former_alpha2, 145 | former_alpha3, 146 | former_numeric, 147 | validity_from, 148 | validity_to, 149 | desc, 150 | ) 151 | ) 152 | new_countries = re.findall(r"(.*?)\((\w+), (\w+), (\d+)\)", x[4]) 153 | for c in new_countries: 154 | c_name = c[0] 155 | c_alpha2 = c[1] 156 | c_alpha3 = c[2] 157 | c_numeric = c[3] 158 | c_numeric = str(int(c_numeric)) 159 | c_name = ( 160 | c_name.replace("Name changed to", "") 161 | .replace("Merged into", "") 162 | .replace("Divided into:", "") 163 | .strip() 164 | ) 165 | print( 166 | """ CountryCode { 167 | name: "%s", 168 | alpha2: "%s", 169 | alpha3: "%s", 170 | numeric: %s, 171 | },""" 172 | % (c_name, c_alpha2, c_alpha3, c_numeric) 173 | ) 174 | print( 175 | """ 176 | ], 177 | }; 178 | """ 179 | ) 180 | 181 | print( 182 | """ 183 | /// Returns the CountryCode3 with the given Alpha4 code, if exists. 184 | /// #Sample 185 | /// ``` 186 | /// let sub = rust_iso3166::iso3166_3::from_code("PZPA"); 187 | /// assert_eq!("Panama Canal Zone", sub.unwrap().name); 188 | /// ``` 189 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen(js_name = from_code_iso_3166_3))] 190 | pub fn from_code(alpha4: &str) -> Option { 191 | ALPHA4_MAP.get(alpha4).cloned() 192 | } 193 | """ 194 | ) 195 | 196 | 197 | print( 198 | """ 199 | ///CountryCode map with alpha4 Code key 200 | pub const ALPHA4_MAP: Map<&str, CountryCode3> = phf_map! { 201 | """ 202 | ) 203 | for x in codes: 204 | print('"%s" => %s,' % (x, x)) 205 | print( 206 | """ 207 | }; 208 | """ 209 | ) 210 | 211 | print( 212 | """ 213 | ///ALL the Countrys struct 214 | pub const ALL: & [CountryCode3] = &[ 215 | """ 216 | ) 217 | for x in codes: 218 | print("%s," % (x)) 219 | print( 220 | """ 221 | ]; 222 | """ 223 | ) 224 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rust_iso/iso3166 2 | 3 | A rust crate providing ISO 3166 1, ISO 3166 2, ISO 3166 3 support. 4 | 5 | ## What is ISO 3166-1 6 | 7 | > ISO 3166-1 is part of the ISO 3166 standard published by the International Organization for Standardization (ISO), and defines codes for the names of countries, dependent territories, and special areas of geographical interest. The official name of the standard is Codes for the representation of names of countries and their subdivisions – Part 1: Country codes. It defines three sets of country codes: 8 | > * ISO 3166-1 alpha-2 – two-letter country codes which are the most widely used of the three, and used most prominently for the Internet's country code top-level domains (with a few exceptions). 9 | > * ISO 3166-1 alpha-3 – three-letter country codes which allow a better visual association between the codes and the country names than the alpha-2 codes. 10 | > * ISO 3166-1 numeric – three-digit country codes which are identical to those developed and maintained by the United Nations Statistics Division, with the advantage of script (writing system) independence, and hence useful for people or systems using non-Latin scripts. 11 | > 12 | > *-- [Wikipedia](http://en.wikipedia.org/wiki/ISO_3166-1)* 13 | 14 | ## What is ISO 3166-2 15 | 16 | > ISO 3166-2 is part of the ISO 3166 standard published by the International Organization for Standardization (ISO), and defines codes for identifying the principal subdivisions (e.g., provinces or states) of all countries coded in ISO 3166-1. The official name of the standard is Codes for the representation of names of countries and their subdivisions – Part 2: Country subdivision code. It was first published in 1998. 17 | 18 | > * The purpose of ISO 3166-2 is to establish an international standard of short and unique alphanumeric codes to represent the relevant administrative divisions and dependent territories of all countries in a more convenient and less ambiguous form than their full names. Each complete ISO 3166-2 code consists of two parts, separated by a hyphen:[1] 19 | > * The first part is the ISO 3166-1 alpha-2 code of the country; 20 | > * The second part is a string of up to three alphanumeric characters, which is usually obtained from national sources and stems from coding systems already in use in the country concerned, but may also be developed by the ISO itself. 21 | > 22 | > *-- [Wikipedia](http://en.wikipedia.org/wiki/ISO_3166-2)* 23 | 24 | ## What is ISO 3166-3 25 | 26 | > ISO 3166-3 is part of the ISO 3166 standard published by the International Organization for Standardization (ISO), and defines codes for country names which have been deleted from ISO 3166-1 since its first publication in 1974. The official name of the standard is Codes for the representation of names of countries and their subdivisions – Part 3: Code for formerly used names of countries.[1] It was first published in 1999. 27 | 28 | > * Each former country name in ISO 3166-3 is assigned a four-letter alphabetic code. The first two letters are the ISO 3166-1 alpha-2 code of the former country, while the last two letters are allocated according to the following rules:[2] 29 | 30 | > * If the country changed its name, the new ISO 3166-1 alpha-2 code is used (e.g., Burma changed its name to Myanmar, whose new alpha-2 code is MM), or the special code AA is used if its alpha-2 code was not changed (e.g., Byelorussian SSR changed its name to Belarus, which has kept the same alpha-2 code). 31 | > * If the country merged into an existing country, the ISO 3166-1 alpha-2 code of this country is used (e.g., the German Democratic Republic merged into Germany, whose alpha-2 code is DE). 32 | > * If the country was divided into several parts, the special code HH is used to indicate that there is no single successor country (e.g., Czechoslovakia was divided into the Czech Republic and Slovakia), with the exception of Serbia and Montenegro, for which XX is used to avoid duplicate use of the same ISO 3166-3 code, as the alpha-2 code CS had twice been deleted from ISO 3166-1, the first time due to the split of Czechoslovakia and the second time due to the split of Serbia and Montenegro. 33 | 34 | > *-- [Wikipedia](http://en.wikipedia.org/wiki/ISO_3166-3)* 35 | 36 | ## Installing 37 | 38 | ``` sh 39 | [dependencies] 40 | rust_iso3166 = "0.1.4" 41 | ``` 42 | 43 | ## Using 44 | 45 | See [using](https://crates.io/crates/rust_iso3166) section of the documentation. 46 | 47 | Quick guide: 48 | 49 | ``` rust 50 | let country = rust_iso3166::from_alpha2("AU"); 51 | let country = rust_iso3166::from_alpha3("AUS"); 52 | let country = rust_iso3166::from_numeric(036); 53 | let country = rust_iso3166::from_numeric_str("036"); 54 | 55 | println!("{:?}", rust_iso3166::ALL); 56 | 57 | println!("{:?}", rust_iso3166::ALL_ALPHA2); 58 | println!("{:?}", rust_iso3166::ALL_ALPHA3); 59 | println!("{:?}", rust_iso3166::ALL_NAME); 60 | println!("{:?}", rust_iso3166::ALL_NUMERIC); 61 | println!("{:?}", rust_iso3166::ALL_NUMERIC_STR); 62 | 63 | println!("{:?}", rust_iso3166::NUMERIC_MAP); 64 | println!("{:?}", rust_iso3166::ALPHA3_MAP); 65 | println!("{:?}", rust_iso3166::ALPHA2_MAP); 66 | 67 | // for ISO 3166-2 68 | let country = rust_iso3166::from_alpha2("GB").unwrap(); 69 | let subdivisions = country.subdivisions(); 70 | assert!(subdivisions.unwrap().len() > 0); 71 | let country = rust_iso3166::iso3166_2::from_code("GB-EDH"); 72 | assert_eq!("Edinburgh, City of", country.unwrap().name); 73 | 74 | // for ISO 3166-3 75 | let sub = rust_iso3166::iso3166_3::from_code("PZPA"); 76 | assert_eq!("Panama Canal Zone", sub.unwrap().name); 77 | ``` 78 | 79 | Data sample: 80 | 81 | ``` rust 82 | CountryCode { 83 | name: "Australia", 84 | alpha2: "AU", 85 | alpha3: "AUS", 86 | numeric: 36 87 | } 88 | 89 | iso3166_2::Subdivision { 90 | name: "Bādghīs", 91 | code: "AF-BDG", 92 | subdivision_type: "Province", 93 | country_name: "Afghanistan", 94 | country_code: "AF", 95 | region_code: "AF-BDG", 96 | } 97 | 98 | iso3166_3::CountryCode3 { 99 | code: "BQAQ", 100 | name: "British Antarctic Territory", 101 | former: CountryCode { 102 | name: "British Antarctic Territory", 103 | alpha2: "BQ", 104 | alpha3: "ATB", 105 | numeric: 0 106 | }, 107 | new_countries: [ 108 | CountryCode { 109 | name: "Antarctica", 110 | alpha2: "AQ", 111 | alpha3: "ATA", 112 | numeric: 010 113 | }, 114 | ], 115 | validity: [1974,1979], 116 | desc: "Merged into Antarctica", 117 | } 118 | ``` 119 | 120 | ## Contributing 121 | 122 | Feel free to submit a pull request or create an issue. 123 | or request to [rust-iso](https://github.com/rust-iso) 124 | 125 | ## License 126 | 127 | rust-iso/rust_iso3166 is licensed under the Apache-2.0 license. 128 | 129 | ## Source(s) 130 | 131 | * [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166) by [Wikipedia](http://www.wikipedia.org) 132 | * [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) by [Wikipedia](http://www.wikipedia.org) 133 | * [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) by [Wikipedia](http://www.wikipedia.org) 134 | * [ISO 3166-3](https://en.wikipedia.org/wiki/ISO_3166-3) by [Wikipedia](http://www.wikipedia.org) 135 | * [www.iso.org](http://www.iso.org) 136 | -------------------------------------------------------------------------------- /scripts/lib.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | pre_code = """ 5 | use phf::phf_map; 6 | use phf::Map; 7 | pub mod iso3166_2; 8 | pub mod iso3166_3; 9 | use std::hash::Hash; 10 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 11 | use wasm_bindgen::prelude::*; 12 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 13 | use js_sys::Array; 14 | 15 | /// # Sample code 16 | /// ``` 17 | /// let country = rust_iso3166::from_alpha2("AU"); 18 | /// assert_eq!("AUS", country.unwrap().alpha3); 19 | /// let country = rust_iso3166::from_alpha3("AUS"); 20 | /// assert_eq!("AU", country.unwrap().alpha2); 21 | /// let country = rust_iso3166::from_numeric(036); 22 | /// assert_eq!("AUS", country.unwrap().alpha3); 23 | /// let country = rust_iso3166::from_numeric_str("036"); 24 | /// assert_eq!("AUS", country.unwrap().alpha3); 25 | /// 26 | /// println!("{:?}", country); 27 | /// println!("{:?}", rust_iso3166::ALL); 28 | 29 | /// println!("{:?}", rust_iso3166::ALL_ALPHA2); 30 | /// println!("{:?}", rust_iso3166::ALL_ALPHA3); 31 | /// println!("{:?}", rust_iso3166::ALL_NAME); 32 | /// println!("{:?}", rust_iso3166::ALL_NUMERIC); 33 | /// println!("{:?}", rust_iso3166::ALL_NUMERIC_STR); 34 | 35 | /// println!("{:?}", rust_iso3166::NUMERIC_MAP); 36 | /// println!("{:?}", rust_iso3166::ALPHA3_MAP); 37 | /// println!("{:?}", rust_iso3166::ALPHA2_MAP); 38 | /// ``` 39 | 40 | /// Data for each Country Code defined by ISO 3166-1 41 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 42 | #[wasm_bindgen] 43 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 44 | pub struct CountryCode { 45 | ///English short name 46 | name: &'static str, 47 | ///Alpha-2 code 48 | alpha2: &'static str, 49 | ///Alpha-3 code 50 | alpha3: &'static str, 51 | ///Numeric code 52 | numeric: i32, 53 | } 54 | 55 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 56 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 57 | pub struct CountryCode { 58 | ///English short name 59 | pub name: &'static str, 60 | ///Alpha-2 code 61 | pub alpha2: &'static str, 62 | ///Alpha-3 code 63 | pub alpha3: &'static str, 64 | ///Numeric code 65 | pub numeric: i32, 66 | } 67 | 68 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 69 | impl CountryCode { 70 | 71 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 72 | #[wasm_bindgen(getter)] 73 | pub fn name(&self) -> String { 74 | self.name.into() 75 | } 76 | 77 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 78 | #[wasm_bindgen(getter)] 79 | pub fn alpha2(&self) -> String { 80 | self.alpha2.into() 81 | } 82 | 83 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 84 | #[wasm_bindgen(getter)] 85 | pub fn alpha3(&self) -> String { 86 | self.alpha3.into() 87 | } 88 | 89 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 90 | #[wasm_bindgen(getter)] 91 | pub fn numeric(&self) -> i32 { 92 | self.numeric 93 | } 94 | 95 | ///Return len 3 String for CountryCode numeric 96 | pub fn numeric_str (&self) -> String { 97 | format!("{:03}", self.numeric) 98 | } 99 | 100 | ///Return Subdivision for ISO 3166-2 101 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 102 | pub fn subdivisions (&self) -> Option<&[iso3166_2::Subdivision]> { 103 | iso3166_2::SUBDIVISION_COUNTRY_MAP.get(self.alpha2).cloned() 104 | } 105 | 106 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 107 | pub fn subdivisions (&self) -> Array { 108 | let ps = iso3166_2::SUBDIVISION_COUNTRY_MAP.get(self.alpha2).cloned(); 109 | let mut vector: Vec = Vec::new(); 110 | match ps { 111 | Some(p) => { 112 | for i in 0..p.len() { 113 | vector.push(p[i]) 114 | } 115 | }, 116 | None => { 117 | 118 | }, 119 | } 120 | 121 | vector.into_iter().map(JsValue::from).collect() 122 | } 123 | } 124 | /// Returns the CountryCode with the given Alpha2 code, if exists. 125 | /// #Sample 126 | /// ``` 127 | /// let country = rust_iso3166::from_alpha2("AU"); 128 | /// assert_eq!("AUS", country.unwrap().alpha3); 129 | /// ``` 130 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 131 | pub fn from_alpha2(alpha2: &str) -> Option { 132 | ALPHA2_MAP.get(alpha2).cloned() 133 | } 134 | 135 | /// Returns the CountryCode with the given Alpha3 code, if exists. 136 | /// #Sample 137 | /// ``` 138 | /// let country = rust_iso3166::from_alpha3("AUS"); 139 | /// assert_eq!(036, country.unwrap().numeric); 140 | /// ``` 141 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 142 | pub fn from_alpha3(alpha3: &str) -> Option { 143 | ALPHA3_MAP.get(alpha3).cloned() 144 | } 145 | 146 | /// Returns the CountryCode with the given numeric , if exists. 147 | // #Sample 148 | /// ``` 149 | /// let country = rust_iso3166::from_numeric(036); 150 | /// assert_eq!("AUS", country.unwrap().alpha3); 151 | /// ``` 152 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 153 | pub fn from_numeric(numeric: i32) -> Option { 154 | let k = format!("{:03}", numeric); 155 | NUMERIC_MAP.get(&k).cloned() 156 | } 157 | 158 | /// Returns the CountryCode with the given numeric 3 length str, if exists. 159 | // #Sample 160 | /// ``` 161 | /// let country = rust_iso3166::from_numeric_str("036"); 162 | /// assert_eq!("AUS", country.unwrap().alpha3); 163 | /// ``` 164 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 165 | pub fn from_numeric_str(numeric: &str) -> Option { 166 | NUMERIC_MAP.get(numeric).cloned() 167 | } 168 | """ 169 | 170 | a = """ 171 | Afghanistan AF AFG 004 ISO 3166-2:AF Yes 172 | Åland Islands AX ALA 248 ISO 3166-2:AX No 173 | Albania AL ALB 008 ISO 3166-2:AL Yes 174 | Algeria DZ DZA 012 ISO 3166-2:DZ Yes 175 | American Samoa AS ASM 016 ISO 3166-2:AS No 176 | Andorra AD AND 020 ISO 3166-2:AD Yes 177 | Angola AO AGO 024 ISO 3166-2:AO Yes 178 | Anguilla AI AIA 660 ISO 3166-2:AI No 179 | Antarctica AQ ATA 010 ISO 3166-2:AQ No 180 | Antigua and Barbuda AG ATG 028 ISO 3166-2:AG Yes 181 | Argentina AR ARG 032 ISO 3166-2:AR Yes 182 | Armenia AM ARM 051 ISO 3166-2:AM Yes 183 | Aruba AW ABW 533 ISO 3166-2:AW No 184 | Australia AU AUS 036 ISO 3166-2:AU Yes 185 | Austria AT AUT 040 ISO 3166-2:AT Yes 186 | Azerbaijan AZ AZE 031 ISO 3166-2:AZ Yes 187 | Bahamas BS BHS 044 ISO 3166-2:BS Yes 188 | Bahrain BH BHR 048 ISO 3166-2:BH Yes 189 | Bangladesh BD BGD 050 ISO 3166-2:BD Yes 190 | Barbados BB BRB 052 ISO 3166-2:BB Yes 191 | Belarus BY BLR 112 ISO 3166-2:BY Yes 192 | Belgium BE BEL 056 ISO 3166-2:BE Yes 193 | Belize BZ BLZ 084 ISO 3166-2:BZ Yes 194 | Benin BJ BEN 204 ISO 3166-2:BJ Yes 195 | Bermuda BM BMU 060 ISO 3166-2:BM No 196 | Bhutan BT BTN 064 ISO 3166-2:BT Yes 197 | Bolivia (Plurinational State of) BO BOL 068 ISO 3166-2:BO Yes 198 | Bonaire, Sint Eustatius and Saba[c] BQ BES 535 ISO 3166-2:BQ No 199 | Bosnia and Herzegovina BA BIH 070 ISO 3166-2:BA Yes 200 | Botswana BW BWA 072 ISO 3166-2:BW Yes 201 | Bouvet Island BV BVT 074 ISO 3166-2:BV No 202 | Brazil BR BRA 076 ISO 3166-2:BR Yes 203 | British Indian Ocean Territory IO IOT 086 ISO 3166-2:IO No 204 | Brunei Darussalam BN BRN 096 ISO 3166-2:BN Yes 205 | Bulgaria BG BGR 100 ISO 3166-2:BG Yes 206 | Burkina Faso BF BFA 854 ISO 3166-2:BF Yes 207 | Burundi BI BDI 108 ISO 3166-2:BI Yes 208 | Cabo Verde CV CPV 132 ISO 3166-2:CV Yes 209 | Cambodia KH KHM 116 ISO 3166-2:KH Yes 210 | Cameroon CM CMR 120 ISO 3166-2:CM Yes 211 | Canada CA CAN 124 ISO 3166-2:CA Yes 212 | Cayman Islands KY CYM 136 ISO 3166-2:KY No 213 | Central African Republic CF CAF 140 ISO 3166-2:CF Yes 214 | Chad TD TCD 148 ISO 3166-2:TD Yes 215 | Chile CL CHL 152 ISO 3166-2:CL Yes 216 | China CN CHN 156 ISO 3166-2:CN Yes 217 | Christmas Island CX CXR 162 ISO 3166-2:CX No 218 | Cocos (Keeling) Islands CC CCK 166 ISO 3166-2:CC No 219 | Colombia CO COL 170 ISO 3166-2:CO Yes 220 | Comoros KM COM 174 ISO 3166-2:KM Yes 221 | Congo CG COG 178 ISO 3166-2:CG Yes 222 | Congo, Democratic Republic of the CD COD 180 ISO 3166-2:CD Yes 223 | Cook Islands CK COK 184 ISO 3166-2:CK No 224 | Costa Rica CR CRI 188 ISO 3166-2:CR Yes 225 | Côte d'Ivoire CI CIV 384 ISO 3166-2:CI Yes 226 | Croatia HR HRV 191 ISO 3166-2:HR Yes 227 | Cuba CU CUB 192 ISO 3166-2:CU Yes 228 | Curaçao CW CUW 531 ISO 3166-2:CW No 229 | Cyprus CY CYP 196 ISO 3166-2:CY Yes 230 | Czechia CZ CZE 203 ISO 3166-2:CZ Yes 231 | Denmark DK DNK 208 ISO 3166-2:DK Yes 232 | Djibouti DJ DJI 262 ISO 3166-2:DJ Yes 233 | Dominica DM DMA 212 ISO 3166-2:DM Yes 234 | Dominican Republic DO DOM 214 ISO 3166-2:DO Yes 235 | Ecuador EC ECU 218 ISO 3166-2:EC Yes 236 | Egypt EG EGY 818 ISO 3166-2:EG Yes 237 | El Salvador SV SLV 222 ISO 3166-2:SV Yes 238 | Equatorial Guinea GQ GNQ 226 ISO 3166-2:GQ Yes 239 | Eritrea ER ERI 232 ISO 3166-2:ER Yes 240 | Estonia EE EST 233 ISO 3166-2:EE Yes 241 | Eswatini SZ SWZ 748 ISO 3166-2:SZ Yes 242 | Ethiopia ET ETH 231 ISO 3166-2:ET Yes 243 | Falkland Islands (Malvinas) FK FLK 238 ISO 3166-2:FK No 244 | Faroe Islands FO FRO 234 ISO 3166-2:FO No 245 | Fiji FJ FJI 242 ISO 3166-2:FJ Yes 246 | Finland FI FIN 246 ISO 3166-2:FI Yes 247 | France FR FRA 250 ISO 3166-2:FR Yes 248 | French Guiana GF GUF 254 ISO 3166-2:GF No 249 | French Polynesia PF PYF 258 ISO 3166-2:PF No 250 | French Southern Territories TF ATF 260 ISO 3166-2:TF No 251 | Gabon GA GAB 266 ISO 3166-2:GA Yes 252 | Gambia GM GMB 270 ISO 3166-2:GM Yes 253 | Georgia GE GEO 268 ISO 3166-2:GE Yes 254 | Germany DE DEU 276 ISO 3166-2:DE Yes 255 | Ghana GH GHA 288 ISO 3166-2:GH Yes 256 | Gibraltar GI GIB 292 ISO 3166-2:GI No 257 | Greece GR GRC 300 ISO 3166-2:GR Yes 258 | Greenland GL GRL 304 ISO 3166-2:GL No 259 | Grenada GD GRD 308 ISO 3166-2:GD Yes 260 | Guadeloupe GP GLP 312 ISO 3166-2:GP No 261 | Guam GU GUM 316 ISO 3166-2:GU No 262 | Guatemala GT GTM 320 ISO 3166-2:GT Yes 263 | Guernsey GG GGY 831 ISO 3166-2:GG No 264 | Guinea GN GIN 324 ISO 3166-2:GN Yes 265 | Guinea-Bissau GW GNB 624 ISO 3166-2:GW Yes 266 | Guyana GY GUY 328 ISO 3166-2:GY Yes 267 | Haiti HT HTI 332 ISO 3166-2:HT Yes 268 | Heard Island and McDonald Islands HM HMD 334 ISO 3166-2:HM No 269 | Holy See VA VAT 336 ISO 3166-2:VA Yes 270 | Honduras HN HND 340 ISO 3166-2:HN Yes 271 | Hong Kong HK HKG 344 ISO 3166-2:HK No 272 | Hungary HU HUN 348 ISO 3166-2:HU Yes 273 | Iceland IS ISL 352 ISO 3166-2:IS Yes 274 | India IN IND 356 ISO 3166-2:IN Yes 275 | Indonesia ID IDN 360 ISO 3166-2:ID Yes 276 | Iran (Islamic Republic of) IR IRN 364 ISO 3166-2:IR Yes 277 | Iraq IQ IRQ 368 ISO 3166-2:IQ Yes 278 | Ireland IE IRL 372 ISO 3166-2:IE Yes 279 | Isle of Man IM IMN 833 ISO 3166-2:IM No 280 | Israel IL ISR 376 ISO 3166-2:IL Yes 281 | Italy IT ITA 380 ISO 3166-2:IT Yes 282 | Jamaica JM JAM 388 ISO 3166-2:JM Yes 283 | Japan JP JPN 392 ISO 3166-2:JP Yes 284 | Jersey JE JEY 832 ISO 3166-2:JE No 285 | Jordan JO JOR 400 ISO 3166-2:JO Yes 286 | Kazakhstan KZ KAZ 398 ISO 3166-2:KZ Yes 287 | Kenya KE KEN 404 ISO 3166-2:KE Yes 288 | Kiribati KI KIR 296 ISO 3166-2:KI Yes 289 | Korea (Democratic People's Republic of) KP PRK 408 ISO 3166-2:KP Yes 290 | Korea, Republic of KR KOR 410 ISO 3166-2:KR Yes 291 | Kuwait KW KWT 414 ISO 3166-2:KW Yes 292 | Kyrgyzstan KG KGZ 417 ISO 3166-2:KG Yes 293 | Lao People's Democratic Republic LA LAO 418 ISO 3166-2:LA Yes 294 | Latvia LV LVA 428 ISO 3166-2:LV Yes 295 | Lebanon LB LBN 422 ISO 3166-2:LB Yes 296 | Lesotho LS LSO 426 ISO 3166-2:LS Yes 297 | Liberia LR LBR 430 ISO 3166-2:LR Yes 298 | Libya LY LBY 434 ISO 3166-2:LY Yes 299 | Liechtenstein LI LIE 438 ISO 3166-2:LI Yes 300 | Lithuania LT LTU 440 ISO 3166-2:LT Yes 301 | Luxembourg LU LUX 442 ISO 3166-2:LU Yes 302 | Macao MO MAC 446 ISO 3166-2:MO No 303 | Madagascar MG MDG 450 ISO 3166-2:MG Yes 304 | Malawi MW MWI 454 ISO 3166-2:MW Yes 305 | Malaysia MY MYS 458 ISO 3166-2:MY Yes 306 | Maldives MV MDV 462 ISO 3166-2:MV Yes 307 | Mali ML MLI 466 ISO 3166-2:ML Yes 308 | Malta MT MLT 470 ISO 3166-2:MT Yes 309 | Marshall Islands MH MHL 584 ISO 3166-2:MH Yes 310 | Martinique MQ MTQ 474 ISO 3166-2:MQ No 311 | Mauritania MR MRT 478 ISO 3166-2:MR Yes 312 | Mauritius MU MUS 480 ISO 3166-2:MU Yes 313 | Mayotte YT MYT 175 ISO 3166-2:YT No 314 | Mexico MX MEX 484 ISO 3166-2:MX Yes 315 | Micronesia (Federated States of) FM FSM 583 ISO 3166-2:FM Yes 316 | Moldova, Republic of MD MDA 498 ISO 3166-2:MD Yes 317 | Monaco MC MCO 492 ISO 3166-2:MC Yes 318 | Mongolia MN MNG 496 ISO 3166-2:MN Yes 319 | Montenegro ME MNE 499 ISO 3166-2:ME Yes 320 | Montserrat MS MSR 500 ISO 3166-2:MS No 321 | Morocco MA MAR 504 ISO 3166-2:MA Yes 322 | Mozambique MZ MOZ 508 ISO 3166-2:MZ Yes 323 | Myanmar MM MMR 104 ISO 3166-2:MM Yes 324 | Namibia NA NAM 516 ISO 3166-2:NA Yes 325 | Nauru NR NRU 520 ISO 3166-2:NR Yes 326 | Nepal NP NPL 524 ISO 3166-2:NP Yes 327 | Netherlands NL NLD 528 ISO 3166-2:NL Yes 328 | New Caledonia NC NCL 540 ISO 3166-2:NC No 329 | New Zealand NZ NZL 554 ISO 3166-2:NZ Yes 330 | Nicaragua NI NIC 558 ISO 3166-2:NI Yes 331 | Niger NE NER 562 ISO 3166-2:NE Yes 332 | Nigeria NG NGA 566 ISO 3166-2:NG Yes 333 | Niue NU NIU 570 ISO 3166-2:NU No 334 | Norfolk Island NF NFK 574 ISO 3166-2:NF No 335 | North Macedonia MK MKD 807 ISO 3166-2:MK Yes 336 | Northern Mariana Islands MP MNP 580 ISO 3166-2:MP No 337 | Norway NO NOR 578 ISO 3166-2:NO Yes 338 | Oman OM OMN 512 ISO 3166-2:OM Yes 339 | Pakistan PK PAK 586 ISO 3166-2:PK Yes 340 | Palau PW PLW 585 ISO 3166-2:PW Yes 341 | Palestine, State of PS PSE 275 ISO 3166-2:PS No 342 | Panama PA PAN 591 ISO 3166-2:PA Yes 343 | Papua New Guinea PG PNG 598 ISO 3166-2:PG Yes 344 | Paraguay PY PRY 600 ISO 3166-2:PY Yes 345 | Peru PE PER 604 ISO 3166-2:PE Yes 346 | Philippines PH PHL 608 ISO 3166-2:PH Yes 347 | Pitcairn PN PCN 612 ISO 3166-2:PN No 348 | Poland PL POL 616 ISO 3166-2:PL Yes 349 | Portugal PT PRT 620 ISO 3166-2:PT Yes 350 | Puerto Rico PR PRI 630 ISO 3166-2:PR No 351 | Qatar QA QAT 634 ISO 3166-2:QA Yes 352 | Réunion RE REU 638 ISO 3166-2:RE No 353 | Romania RO ROU 642 ISO 3166-2:RO Yes 354 | Russian Federation RU RUS 643 ISO 3166-2:RU Yes 355 | Rwanda RW RWA 646 ISO 3166-2:RW Yes 356 | Saint Barthélemy BL BLM 652 ISO 3166-2:BL No 357 | Saint Helena, Ascension and Tristan da Cunha[d] SH SHN 654 ISO 3166-2:SH No 358 | Saint Kitts and Nevis KN KNA 659 ISO 3166-2:KN Yes 359 | Saint Lucia LC LCA 662 ISO 3166-2:LC Yes 360 | Saint Martin (French part) MF MAF 663 ISO 3166-2:MF No 361 | Saint Pierre and Miquelon PM SPM 666 ISO 3166-2:PM No 362 | Saint Vincent and the Grenadines VC VCT 670 ISO 3166-2:VC Yes 363 | Samoa WS WSM 882 ISO 3166-2:WS Yes 364 | San Marino SM SMR 674 ISO 3166-2:SM Yes 365 | Sao Tome and Principe ST STP 678 ISO 3166-2:ST Yes 366 | Saudi Arabia SA SAU 682 ISO 3166-2:SA Yes 367 | Senegal SN SEN 686 ISO 3166-2:SN Yes 368 | Serbia RS SRB 688 ISO 3166-2:RS Yes 369 | Seychelles SC SYC 690 ISO 3166-2:SC Yes 370 | Sierra Leone SL SLE 694 ISO 3166-2:SL Yes 371 | Singapore SG SGP 702 ISO 3166-2:SG Yes 372 | Sint Maarten (Dutch part) SX SXM 534 ISO 3166-2:SX No 373 | Slovakia SK SVK 703 ISO 3166-2:SK Yes 374 | Slovenia SI SVN 705 ISO 3166-2:SI Yes 375 | Solomon Islands SB SLB 090 ISO 3166-2:SB Yes 376 | Somalia SO SOM 706 ISO 3166-2:SO Yes 377 | South Africa ZA ZAF 710 ISO 3166-2:ZA Yes 378 | South Georgia and the South Sandwich Islands GS SGS 239 ISO 3166-2:GS No 379 | South Sudan SS SSD 728 ISO 3166-2:SS Yes 380 | Spain ES ESP 724 ISO 3166-2:ES Yes 381 | Sri Lanka LK LKA 144 ISO 3166-2:LK Yes 382 | Sudan SD SDN 729 ISO 3166-2:SD Yes 383 | Suriname SR SUR 740 ISO 3166-2:SR Yes 384 | Svalbard and Jan Mayen[e] SJ SJM 744 ISO 3166-2:SJ No 385 | Sweden SE SWE 752 ISO 3166-2:SE Yes 386 | Switzerland CH CHE 756 ISO 3166-2:CH Yes 387 | Syrian Arab Republic SY SYR 760 ISO 3166-2:SY Yes 388 | Taiwan, Province of China TW TWN 158 ISO 3166-2:TW No 389 | Tajikistan TJ TJK 762 ISO 3166-2:TJ Yes 390 | Tanzania, United Republic of TZ TZA 834 ISO 3166-2:TZ Yes 391 | Thailand TH THA 764 ISO 3166-2:TH Yes 392 | Timor-Leste TL TLS 626 ISO 3166-2:TL Yes 393 | Togo TG TGO 768 ISO 3166-2:TG Yes 394 | Tokelau TK TKL 772 ISO 3166-2:TK No 395 | Tonga TO TON 776 ISO 3166-2:TO Yes 396 | Trinidad and Tobago TT TTO 780 ISO 3166-2:TT Yes 397 | Tunisia TN TUN 788 ISO 3166-2:TN Yes 398 | Turkey TR TUR 792 ISO 3166-2:TR Yes 399 | Turkmenistan TM TKM 795 ISO 3166-2:TM Yes 400 | Turks and Caicos Islands TC TCA 796 ISO 3166-2:TC No 401 | Tuvalu TV TUV 798 ISO 3166-2:TV Yes 402 | Uganda UG UGA 800 ISO 3166-2:UG Yes 403 | Ukraine UA UKR 804 ISO 3166-2:UA Yes 404 | United Arab Emirates AE ARE 784 ISO 3166-2:AE Yes 405 | United Kingdom of Great Britain and Northern Ireland GB GBR 826 ISO 3166-2:GB Yes 406 | United States of America US USA 840 ISO 3166-2:US Yes 407 | United States Minor Outlying Islands[f] UM UMI 581 ISO 3166-2:UM No 408 | Uruguay UY URY 858 ISO 3166-2:UY Yes 409 | Uzbekistan UZ UZB 860 ISO 3166-2:UZ Yes 410 | Vanuatu VU VUT 548 ISO 3166-2:VU Yes 411 | Venezuela (Bolivarian Republic of) VE VEN 862 ISO 3166-2:VE Yes 412 | Viet Nam VN VNM 704 ISO 3166-2:VN Yes 413 | Virgin Islands (British) VG VGB 092 ISO 3166-2:VG No 414 | Virgin Islands (U.S.) VI VIR 850 ISO 3166-2:VI No 415 | Wallis and Futuna WF WLF 876 ISO 3166-2:WF No 416 | Western Sahara EH ESH 732 ISO 3166-2:EH No 417 | Yemen YE YEM 887 ISO 3166-2:YE Yes 418 | Zambia ZM ZMB 894 ISO 3166-2:ZM Yes 419 | Zimbabwe ZW ZWE 716 ISO 3166-2:ZW Yes 420 | """ 421 | print(pre_code) 422 | 423 | for x in a.split("\n"): 424 | ts = x.split("\t") 425 | if len(ts) < 2: 426 | print(x) 427 | continue 428 | print( 429 | """ 430 | pub const %s: CountryCode = CountryCode { 431 | name: "%s", 432 | alpha2: "%s", 433 | alpha3: "%s", 434 | numeric: %s, 435 | }; 436 | """ 437 | % (ts[1], ts[0], ts[1], ts[2], int(ts[3])) 438 | ) 439 | 440 | 441 | print( 442 | """ 443 | ///CountryCode map with alpha2 Code key 444 | pub const ALPHA2_MAP: Map<&str, CountryCode> = phf_map! { 445 | """ 446 | ) 447 | for x in a.split("\n"): 448 | ts = x.split("\t") 449 | if len(ts) < 2: 450 | print(x) 451 | continue 452 | print('"%s" => %s,' % (ts[1], ts[1])) 453 | print( 454 | """ 455 | }; 456 | """ 457 | ) 458 | 459 | print( 460 | """ 461 | ///CountryCode map with alpha3 Code key 462 | pub const ALPHA3_MAP: Map<&str, CountryCode> = phf_map! { 463 | """ 464 | ) 465 | for x in a.split("\n"): 466 | ts = x.split("\t") 467 | if len(ts) < 2: 468 | print(x) 469 | continue 470 | print('"%s" => %s,' % (ts[2], ts[1])) 471 | print( 472 | """ 473 | }; 474 | """ 475 | ) 476 | 477 | print( 478 | """ 479 | ///CountryCode map with 3 len numeric str Code key 480 | pub const NUMERIC_MAP: Map<&str, CountryCode> = phf_map! { 481 | """ 482 | ) 483 | for x in a.split("\n"): 484 | ts = x.split("\t") 485 | if len(ts) < 2: 486 | print(x) 487 | continue 488 | print('"%s" => %s,' % (ts[3], ts[1])) 489 | print( 490 | """ 491 | }; 492 | """ 493 | ) 494 | 495 | print( 496 | """ 497 | ///ALL the names of Countrys 498 | pub const ALL_NAME: & [&str] = &[ 499 | """ 500 | ) 501 | for x in a.split("\n"): 502 | ts = x.split("\t") 503 | if len(ts) < 2: 504 | print(x) 505 | continue 506 | print('"%s",' % (ts[0])) 507 | print( 508 | """ 509 | ]; 510 | """ 511 | ) 512 | 513 | print( 514 | """ 515 | ///ALL the alpha2 codes of Countrys 516 | pub const ALL_ALPHA2: & [&str] = &[ 517 | """ 518 | ) 519 | for x in a.split("\n"): 520 | ts = x.split("\t") 521 | if len(ts) < 2: 522 | print(x) 523 | continue 524 | print('"%s",' % (ts[1])) 525 | print( 526 | """ 527 | ]; 528 | """ 529 | ) 530 | print( 531 | """ 532 | ///ALL the alpha3 codes of Countrys 533 | pub const ALL_ALPHA3: & [&str] = &[ 534 | """ 535 | ) 536 | for x in a.split("\n"): 537 | ts = x.split("\t") 538 | if len(ts) < 2: 539 | print(x) 540 | continue 541 | print('"%s",' % (ts[2])) 542 | print( 543 | """ 544 | ]; 545 | """ 546 | ) 547 | 548 | print( 549 | """ 550 | ///ALL the 3 length numeric str codes of Countrys 551 | pub const ALL_NUMERIC_STR: & [&str] = &[ 552 | """ 553 | ) 554 | for x in a.split("\n"): 555 | ts = x.split("\t") 556 | if len(ts) < 2: 557 | print(x) 558 | continue 559 | print('"%s",' % (ts[3])) 560 | print( 561 | """ 562 | ]; 563 | """ 564 | ) 565 | 566 | print( 567 | """ 568 | ///ALL the numeric codes of Countrys 569 | pub const ALL_NUMERIC: & [i32] = &[ 570 | """ 571 | ) 572 | for x in a.split("\n"): 573 | ts = x.split("\t") 574 | if len(ts) < 2: 575 | print(x) 576 | continue 577 | print("%s," % (int(ts[3]))) 578 | print( 579 | """ 580 | ]; 581 | """ 582 | ) 583 | 584 | print( 585 | """ 586 | ///ALL the Countrys struct 587 | pub const ALL: & [CountryCode] = &[ 588 | """ 589 | ) 590 | for x in a.split("\n"): 591 | ts = x.split("\t") 592 | if len(ts) < 2: 593 | print(x) 594 | continue 595 | print("%s," % (ts[1])) 596 | print( 597 | """ 598 | ]; 599 | """ 600 | ) 601 | -------------------------------------------------------------------------------- /src/iso3166_3.rs: -------------------------------------------------------------------------------- 1 | 2 | use phf::phf_map; 3 | use phf::Map; 4 | use crate::CountryCode; 5 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 6 | use wasm_bindgen::prelude::*; 7 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 8 | use js_sys::Array; 9 | 10 | /// Data for each Country Code defined by ISO 3166-1 11 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 12 | #[wasm_bindgen] 13 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 14 | pub struct CountryCode3 { 15 | ///ISO 3166-3 code 16 | code: &'static str, 17 | ///Former country name 18 | name: &'static str, 19 | 20 | former: CountryCode, 21 | new_countries: &'static [CountryCode], 22 | 23 | ///Period of validity 24 | validity: &'static [i32], 25 | ///Decription 26 | desc: &'static str, 27 | 28 | } 29 | 30 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 31 | #[wasm_bindgen] 32 | impl CountryCode3 { 33 | #[wasm_bindgen(getter)] 34 | pub fn code(&self) -> String { 35 | self.code.into() 36 | } 37 | 38 | #[wasm_bindgen(getter)] 39 | pub fn name(&self) -> String { 40 | self.name.into() 41 | } 42 | 43 | #[wasm_bindgen(getter)] 44 | pub fn former(&self) -> CountryCode { 45 | self.former 46 | } 47 | 48 | #[wasm_bindgen(getter)] 49 | pub fn new_countries(&self) -> Array { 50 | let mut vector: Vec = Vec::new(); 51 | // self.individual_languages.into_serde().unwrap(); 52 | for i in 0..self.new_countries.len() { 53 | vector.push(self.new_countries[i]) 54 | } 55 | vector.into_iter().map(JsValue::from).collect() 56 | } 57 | 58 | #[wasm_bindgen(getter)] 59 | pub fn desc(&self) -> String { 60 | self.desc.into() 61 | } 62 | } 63 | 64 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 65 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 66 | pub struct CountryCode3 { 67 | ///ISO 3166-3 code 68 | pub code: &'static str, 69 | ///Former country name 70 | pub name: &'static str, 71 | 72 | pub former: CountryCode, 73 | pub new_countries: &'static [CountryCode], 74 | 75 | ///Period of validity 76 | pub validity: &'static [i32], 77 | ///Decription 78 | pub desc: &'static str, 79 | 80 | } 81 | 82 | 83 | pub const BQAQ: CountryCode3 = CountryCode3 { 84 | code: "BQAQ", 85 | name: "British Antarctic Territory", 86 | former: CountryCode { 87 | name: "British Antarctic Territory", 88 | alpha2: "BQ", 89 | alpha3: "ATB", 90 | numeric: 0, 91 | }, 92 | validity: &[1974,1979], 93 | desc: "Merged into Antarctica ", 94 | new_countries: &[ 95 | 96 | CountryCode { 97 | name: "Antarctica", 98 | alpha2: "AQ", 99 | alpha3: "ATA", 100 | numeric: 10, 101 | }, 102 | 103 | ], 104 | }; 105 | 106 | 107 | pub const BUMM: CountryCode3 = CountryCode3 { 108 | code: "BUMM", 109 | name: "Burma", 110 | former: CountryCode { 111 | name: "Burma", 112 | alpha2: "BU", 113 | alpha3: "BUR", 114 | numeric: 104, 115 | }, 116 | validity: &[1974,1989], 117 | desc: "Name changed to Myanmar ", 118 | new_countries: &[ 119 | 120 | CountryCode { 121 | name: "Myanmar", 122 | alpha2: "MM", 123 | alpha3: "MMR", 124 | numeric: 104, 125 | }, 126 | 127 | ], 128 | }; 129 | 130 | 131 | pub const BYAA: CountryCode3 = CountryCode3 { 132 | code: "BYAA", 133 | name: "Byelorussian SSR", 134 | former: CountryCode { 135 | name: "Byelorussian SSR", 136 | alpha2: "BY", 137 | alpha3: "BYS", 138 | numeric: 112, 139 | }, 140 | validity: &[1974,1992], 141 | desc: "Name changed to Belarus ", 142 | new_countries: &[ 143 | 144 | CountryCode { 145 | name: "Belarus", 146 | alpha2: "BY", 147 | alpha3: "BLR", 148 | numeric: 112, 149 | }, 150 | 151 | ], 152 | }; 153 | 154 | 155 | pub const CTKI: CountryCode3 = CountryCode3 { 156 | code: "CTKI", 157 | name: "Canton and Enderbury Islands", 158 | former: CountryCode { 159 | name: "Canton and Enderbury Islands", 160 | alpha2: "CT", 161 | alpha3: "CTE", 162 | numeric: 128, 163 | }, 164 | validity: &[1974,1984], 165 | desc: "Merged into Kiribati ", 166 | new_countries: &[ 167 | 168 | CountryCode { 169 | name: "Kiribati", 170 | alpha2: "KI", 171 | alpha3: "KIR", 172 | numeric: 296, 173 | }, 174 | 175 | ], 176 | }; 177 | 178 | 179 | pub const CSHH: CountryCode3 = CountryCode3 { 180 | code: "CSHH", 181 | name: "Czechoslovakia", 182 | former: CountryCode { 183 | name: "Czechoslovakia", 184 | alpha2: "CS", 185 | alpha3: "CSK", 186 | numeric: 200, 187 | }, 188 | validity: &[1974,1993], 189 | desc: "Divided into: Czechia Slovakia ", 190 | new_countries: &[ 191 | 192 | CountryCode { 193 | name: "Czechia", 194 | alpha2: "CZ", 195 | alpha3: "CZE", 196 | numeric: 203, 197 | }, 198 | CountryCode { 199 | name: "Slovakia", 200 | alpha2: "SK", 201 | alpha3: "SVK", 202 | numeric: 703, 203 | }, 204 | 205 | ], 206 | }; 207 | 208 | 209 | pub const DYBJ: CountryCode3 = CountryCode3 { 210 | code: "DYBJ", 211 | name: "Dahomey", 212 | former: CountryCode { 213 | name: "Dahomey", 214 | alpha2: "DY", 215 | alpha3: "DHY", 216 | numeric: 204, 217 | }, 218 | validity: &[1974,1977], 219 | desc: "Name changed to Benin ", 220 | new_countries: &[ 221 | 222 | CountryCode { 223 | name: "Benin", 224 | alpha2: "BJ", 225 | alpha3: "BEN", 226 | numeric: 204, 227 | }, 228 | 229 | ], 230 | }; 231 | 232 | 233 | pub const NQAQ: CountryCode3 = CountryCode3 { 234 | code: "NQAQ", 235 | name: "Dronning Maud Land", 236 | former: CountryCode { 237 | name: "Dronning Maud Land", 238 | alpha2: "NQ", 239 | alpha3: "ATN", 240 | numeric: 216, 241 | }, 242 | validity: &[1974,1983], 243 | desc: "Merged into Antarctica ", 244 | new_countries: &[ 245 | 246 | CountryCode { 247 | name: "Antarctica", 248 | alpha2: "AQ", 249 | alpha3: "ATA", 250 | numeric: 10, 251 | }, 252 | 253 | ], 254 | }; 255 | 256 | 257 | pub const TPTL: CountryCode3 = CountryCode3 { 258 | code: "TPTL", 259 | name: "East Timor", 260 | former: CountryCode { 261 | name: "East Timor", 262 | alpha2: "TP", 263 | alpha3: "TMP", 264 | numeric: 626, 265 | }, 266 | validity: &[1974,2002], 267 | desc: "Name changed to Timor-Leste ", 268 | new_countries: &[ 269 | 270 | CountryCode { 271 | name: "Timor-Leste", 272 | alpha2: "TL", 273 | alpha3: "TLS", 274 | numeric: 626, 275 | }, 276 | 277 | ], 278 | }; 279 | 280 | 281 | pub const FXFR: CountryCode3 = CountryCode3 { 282 | code: "FXFR", 283 | name: "France, Metropolitan", 284 | former: CountryCode { 285 | name: "France, Metropolitan", 286 | alpha2: "FX", 287 | alpha3: "FXX", 288 | numeric: 249, 289 | }, 290 | validity: &[1993,1997], 291 | desc: "Merged into France ", 292 | new_countries: &[ 293 | 294 | CountryCode { 295 | name: "France", 296 | alpha2: "FR", 297 | alpha3: "FRA", 298 | numeric: 250, 299 | }, 300 | 301 | ], 302 | }; 303 | 304 | 305 | pub const AIDJ: CountryCode3 = CountryCode3 { 306 | code: "AIDJ", 307 | name: "French Afars and Issas", 308 | former: CountryCode { 309 | name: "French Afars and Issas", 310 | alpha2: "AI", 311 | alpha3: "AFI", 312 | numeric: 262, 313 | }, 314 | validity: &[1974,1977], 315 | desc: "Name changed to Djibouti ", 316 | new_countries: &[ 317 | 318 | CountryCode { 319 | name: "Djibouti", 320 | alpha2: "DJ", 321 | alpha3: "DJI", 322 | numeric: 262, 323 | }, 324 | 325 | ], 326 | }; 327 | 328 | 329 | pub const FQHH: CountryCode3 = CountryCode3 { 330 | code: "FQHH", 331 | name: "French Southern and Antarctic Territories", 332 | former: CountryCode { 333 | name: "French Southern and Antarctic Territories", 334 | alpha2: "FQ", 335 | alpha3: "ATF", 336 | numeric: 0, 337 | }, 338 | validity: &[1974,1979], 339 | desc: "Divided into: Part of Antarctica French Southern Territories ", 340 | new_countries: &[ 341 | 342 | CountryCode { 343 | name: "Part of Antarctica", 344 | alpha2: "AQ", 345 | alpha3: "ATA", 346 | numeric: 10, 347 | }, 348 | CountryCode { 349 | name: "French Southern Territories", 350 | alpha2: "TF", 351 | alpha3: "ATF", 352 | numeric: 260, 353 | }, 354 | 355 | ], 356 | }; 357 | 358 | 359 | pub const DDDE: CountryCode3 = CountryCode3 { 360 | code: "DDDE", 361 | name: "German Democratic Republic", 362 | former: CountryCode { 363 | name: "German Democratic Republic", 364 | alpha2: "DD", 365 | alpha3: "DDR", 366 | numeric: 278, 367 | }, 368 | validity: &[1974,1990], 369 | desc: "Merged into Germany ", 370 | new_countries: &[ 371 | 372 | CountryCode { 373 | name: "Germany", 374 | alpha2: "DE", 375 | alpha3: "DEU", 376 | numeric: 276, 377 | }, 378 | 379 | ], 380 | }; 381 | 382 | 383 | pub const GEHH: CountryCode3 = CountryCode3 { 384 | code: "GEHH", 385 | name: "Gilbert Islands", 386 | former: CountryCode { 387 | name: "Gilbert Islands", 388 | alpha2: "GE", 389 | alpha3: "GEL", 390 | numeric: 296, 391 | }, 392 | validity: &[1974,1979], 393 | desc: "Name changed to Kiribati ", 394 | new_countries: &[ 395 | 396 | CountryCode { 397 | name: "Kiribati", 398 | alpha2: "KI", 399 | alpha3: "KIR", 400 | numeric: 296, 401 | }, 402 | 403 | ], 404 | }; 405 | 406 | 407 | pub const JTUM: CountryCode3 = CountryCode3 { 408 | code: "JTUM", 409 | name: "Johnston Island", 410 | former: CountryCode { 411 | name: "Johnston Island", 412 | alpha2: "JT", 413 | alpha3: "JTN", 414 | numeric: 396, 415 | }, 416 | validity: &[1974,1986], 417 | desc: "Merged into United States Minor Outlying Islands ", 418 | new_countries: &[ 419 | 420 | CountryCode { 421 | name: "United States Minor Outlying Islands", 422 | alpha2: "UM", 423 | alpha3: "UMI", 424 | numeric: 581, 425 | }, 426 | 427 | ], 428 | }; 429 | 430 | 431 | pub const MIUM: CountryCode3 = CountryCode3 { 432 | code: "MIUM", 433 | name: "Midway Islands", 434 | former: CountryCode { 435 | name: "Midway Islands", 436 | alpha2: "MI", 437 | alpha3: "MID", 438 | numeric: 488, 439 | }, 440 | validity: &[1974,1986], 441 | desc: "Merged into United States Minor Outlying Islands ", 442 | new_countries: &[ 443 | 444 | CountryCode { 445 | name: "United States Minor Outlying Islands", 446 | alpha2: "UM", 447 | alpha3: "UMI", 448 | numeric: 581, 449 | }, 450 | 451 | ], 452 | }; 453 | 454 | 455 | pub const ANHH: CountryCode3 = CountryCode3 { 456 | code: "ANHH", 457 | name: "Netherlands Antilles", 458 | former: CountryCode { 459 | name: "Netherlands Antilles", 460 | alpha2: "AN", 461 | alpha3: "ANT", 462 | numeric: 530, 463 | }, 464 | validity: &[1974,2010 ], 465 | desc: "Divided into: Bonaire, Sint Eustatius and Saba Curaçao Sint Maarten ", 466 | new_countries: &[ 467 | 468 | CountryCode { 469 | name: "Bonaire, Sint Eustatius and Saba", 470 | alpha2: "BQ", 471 | alpha3: "BES", 472 | numeric: 535, 473 | }, 474 | CountryCode { 475 | name: "Curaçao", 476 | alpha2: "CW", 477 | alpha3: "CUW", 478 | numeric: 531, 479 | }, 480 | CountryCode { 481 | name: "Sint Maarten (Dutch part)", 482 | alpha2: "SX", 483 | alpha3: "SXM", 484 | numeric: 534, 485 | }, 486 | 487 | ], 488 | }; 489 | 490 | 491 | pub const NTHH: CountryCode3 = CountryCode3 { 492 | code: "NTHH", 493 | name: "Neutral Zone", 494 | former: CountryCode { 495 | name: "Neutral Zone", 496 | alpha2: "NT", 497 | alpha3: "NTZ", 498 | numeric: 536, 499 | }, 500 | validity: &[1974,1993], 501 | desc: "Divided into: Part of Iraq Part of Saudi Arabia ", 502 | new_countries: &[ 503 | 504 | CountryCode { 505 | name: "Part of Iraq", 506 | alpha2: "IQ", 507 | alpha3: "IRQ", 508 | numeric: 368, 509 | }, 510 | CountryCode { 511 | name: "Part of Saudi Arabia", 512 | alpha2: "SA", 513 | alpha3: "SAU", 514 | numeric: 682, 515 | }, 516 | 517 | ], 518 | }; 519 | 520 | 521 | pub const NHVU: CountryCode3 = CountryCode3 { 522 | code: "NHVU", 523 | name: "New Hebrides", 524 | former: CountryCode { 525 | name: "New Hebrides", 526 | alpha2: "NH", 527 | alpha3: "NHB", 528 | numeric: 548, 529 | }, 530 | validity: &[1974,1980], 531 | desc: "Name changed to Vanuatu ", 532 | new_countries: &[ 533 | 534 | CountryCode { 535 | name: "Vanuatu", 536 | alpha2: "VU", 537 | alpha3: "VUT", 538 | numeric: 548, 539 | }, 540 | 541 | ], 542 | }; 543 | 544 | 545 | pub const PCHH: CountryCode3 = CountryCode3 { 546 | code: "PCHH", 547 | name: "Pacific Islands (Trust Territory)", 548 | former: CountryCode { 549 | name: "Pacific Islands (Trust Territory)", 550 | alpha2: "PC", 551 | alpha3: "PCI", 552 | numeric: 582, 553 | }, 554 | validity: &[1974,1986], 555 | desc: "Divided into: Marshall Islands Micronesia Northern Mariana Islands Palau ", 556 | new_countries: &[ 557 | 558 | CountryCode { 559 | name: "Marshall Islands", 560 | alpha2: "MH", 561 | alpha3: "MHL", 562 | numeric: 584, 563 | }, 564 | CountryCode { 565 | name: "Micronesia (Federated States of)", 566 | alpha2: "FM", 567 | alpha3: "FSM", 568 | numeric: 583, 569 | }, 570 | CountryCode { 571 | name: "Northern Mariana Islands", 572 | alpha2: "MP", 573 | alpha3: "MNP", 574 | numeric: 580, 575 | }, 576 | CountryCode { 577 | name: "Palau", 578 | alpha2: "PW", 579 | alpha3: "PLW", 580 | numeric: 585, 581 | }, 582 | 583 | ], 584 | }; 585 | 586 | 587 | pub const PZPA: CountryCode3 = CountryCode3 { 588 | code: "PZPA", 589 | name: "Panama Canal Zone", 590 | former: CountryCode { 591 | name: "Panama Canal Zone", 592 | alpha2: "PZ", 593 | alpha3: "PCZ", 594 | numeric: 0, 595 | }, 596 | validity: &[1974,1980], 597 | desc: "Merged into Panama ", 598 | new_countries: &[ 599 | 600 | CountryCode { 601 | name: "Panama", 602 | alpha2: "PA", 603 | alpha3: "PAN", 604 | numeric: 591, 605 | }, 606 | 607 | ], 608 | }; 609 | 610 | 611 | pub const CSXX: CountryCode3 = CountryCode3 { 612 | code: "CSXX", 613 | name: "Serbia and Montenegro", 614 | former: CountryCode { 615 | name: "Serbia and Montenegro", 616 | alpha2: "CS", 617 | alpha3: "SCG", 618 | numeric: 891, 619 | }, 620 | validity: &[2003,2006], 621 | desc: "Divided into: Montenegro Serbia ", 622 | new_countries: &[ 623 | 624 | CountryCode { 625 | name: "Montenegro", 626 | alpha2: "ME", 627 | alpha3: "MNE", 628 | numeric: 499, 629 | }, 630 | CountryCode { 631 | name: "Serbia", 632 | alpha2: "RS", 633 | alpha3: "SRB", 634 | numeric: 688, 635 | }, 636 | 637 | ], 638 | }; 639 | 640 | 641 | pub const SKIN: CountryCode3 = CountryCode3 { 642 | code: "SKIN", 643 | name: "Sikkim", 644 | former: CountryCode { 645 | name: "Sikkim", 646 | alpha2: "SK", 647 | alpha3: "SKM", 648 | numeric: 0, 649 | }, 650 | validity: &[1974,1975], 651 | desc: "Merged into India ", 652 | new_countries: &[ 653 | 654 | CountryCode { 655 | name: "India", 656 | alpha2: "IN", 657 | alpha3: "IND", 658 | numeric: 356, 659 | }, 660 | 661 | ], 662 | }; 663 | 664 | 665 | pub const RHZW: CountryCode3 = CountryCode3 { 666 | code: "RHZW", 667 | name: "Southern Rhodesia", 668 | former: CountryCode { 669 | name: "Southern Rhodesia", 670 | alpha2: "RH", 671 | alpha3: "RHO", 672 | numeric: 716, 673 | }, 674 | validity: &[1974,1980], 675 | desc: "Name changed to Zimbabwe ", 676 | new_countries: &[ 677 | 678 | CountryCode { 679 | name: "Zimbabwe", 680 | alpha2: "ZW", 681 | alpha3: "ZWE", 682 | numeric: 716, 683 | }, 684 | 685 | ], 686 | }; 687 | 688 | 689 | pub const PUUM: CountryCode3 = CountryCode3 { 690 | code: "PUUM", 691 | name: "United States Miscellaneous Pacific Islands", 692 | former: CountryCode { 693 | name: "United States Miscellaneous Pacific Islands", 694 | alpha2: "PU", 695 | alpha3: "PUS", 696 | numeric: 849, 697 | }, 698 | validity: &[1974,1986], 699 | desc: "Merged into United States Minor Outlying Islands ", 700 | new_countries: &[ 701 | 702 | CountryCode { 703 | name: "United States Minor Outlying Islands", 704 | alpha2: "UM", 705 | alpha3: "UMI", 706 | numeric: 581, 707 | }, 708 | 709 | ], 710 | }; 711 | 712 | 713 | pub const HVBF: CountryCode3 = CountryCode3 { 714 | code: "HVBF", 715 | name: "Upper Volta", 716 | former: CountryCode { 717 | name: "Upper Volta", 718 | alpha2: "HV", 719 | alpha3: "HVO", 720 | numeric: 854, 721 | }, 722 | validity: &[1974,1984], 723 | desc: "Name changed to Burkina Faso ", 724 | new_countries: &[ 725 | 726 | CountryCode { 727 | name: "Burkina Faso", 728 | alpha2: "BF", 729 | alpha3: "BFA", 730 | numeric: 854, 731 | }, 732 | 733 | ], 734 | }; 735 | 736 | 737 | pub const SUHH: CountryCode3 = CountryCode3 { 738 | code: "SUHH", 739 | name: "USSR", 740 | former: CountryCode { 741 | name: "USSR", 742 | alpha2: "SU", 743 | alpha3: "SUN", 744 | numeric: 810, 745 | }, 746 | validity: &[1974,1992], 747 | desc: "Divided into: Armenia Azerbaijan Estonia Georgia Kazakhstan Kyrgyzstan Latvia Lithuania Moldova, Republic of Russian Federation Tajikistan Turkmenistan Uzbekistan ", 748 | new_countries: &[ 749 | 750 | CountryCode { 751 | name: "Armenia", 752 | alpha2: "AM", 753 | alpha3: "ARM", 754 | numeric: 51, 755 | }, 756 | CountryCode { 757 | name: "Azerbaijan", 758 | alpha2: "AZ", 759 | alpha3: "AZE", 760 | numeric: 31, 761 | }, 762 | CountryCode { 763 | name: "Estonia", 764 | alpha2: "EE", 765 | alpha3: "EST", 766 | numeric: 233, 767 | }, 768 | CountryCode { 769 | name: "Georgia", 770 | alpha2: "GE", 771 | alpha3: "GEO", 772 | numeric: 268, 773 | }, 774 | CountryCode { 775 | name: "Kazakhstan", 776 | alpha2: "KZ", 777 | alpha3: "KAZ", 778 | numeric: 398, 779 | }, 780 | CountryCode { 781 | name: "Kyrgyzstan", 782 | alpha2: "KG", 783 | alpha3: "KGZ", 784 | numeric: 417, 785 | }, 786 | CountryCode { 787 | name: "Latvia", 788 | alpha2: "LV", 789 | alpha3: "LVA", 790 | numeric: 428, 791 | }, 792 | CountryCode { 793 | name: "Lithuania", 794 | alpha2: "LT", 795 | alpha3: "LTU", 796 | numeric: 440, 797 | }, 798 | CountryCode { 799 | name: "Moldova, Republic of", 800 | alpha2: "MD", 801 | alpha3: "MDA", 802 | numeric: 498, 803 | }, 804 | CountryCode { 805 | name: "Russian Federation", 806 | alpha2: "RU", 807 | alpha3: "RUS", 808 | numeric: 643, 809 | }, 810 | CountryCode { 811 | name: "Tajikistan", 812 | alpha2: "TJ", 813 | alpha3: "TJK", 814 | numeric: 762, 815 | }, 816 | CountryCode { 817 | name: "Turkmenistan", 818 | alpha2: "TM", 819 | alpha3: "TKM", 820 | numeric: 795, 821 | }, 822 | CountryCode { 823 | name: "Uzbekistan", 824 | alpha2: "UZ", 825 | alpha3: "UZB", 826 | numeric: 860, 827 | }, 828 | 829 | ], 830 | }; 831 | 832 | 833 | pub const VDVN: CountryCode3 = CountryCode3 { 834 | code: "VDVN", 835 | name: "Viet-Nam, Democratic Republic of", 836 | former: CountryCode { 837 | name: "Viet-Nam, Democratic Republic of", 838 | alpha2: "VD", 839 | alpha3: "VDR", 840 | numeric: 0, 841 | }, 842 | validity: &[1974,1977], 843 | desc: "Merged into Viet Nam ", 844 | new_countries: &[ 845 | 846 | CountryCode { 847 | name: "Viet Nam", 848 | alpha2: "VN", 849 | alpha3: "VNM", 850 | numeric: 704, 851 | }, 852 | 853 | ], 854 | }; 855 | 856 | 857 | pub const WKUM: CountryCode3 = CountryCode3 { 858 | code: "WKUM", 859 | name: "Wake Island", 860 | former: CountryCode { 861 | name: "Wake Island", 862 | alpha2: "WK", 863 | alpha3: "WAK", 864 | numeric: 872, 865 | }, 866 | validity: &[1974,1986], 867 | desc: "Merged into United States Minor Outlying Islands ", 868 | new_countries: &[ 869 | 870 | CountryCode { 871 | name: "United States Minor Outlying Islands", 872 | alpha2: "UM", 873 | alpha3: "UMI", 874 | numeric: 581, 875 | }, 876 | 877 | ], 878 | }; 879 | 880 | 881 | pub const YDYE: CountryCode3 = CountryCode3 { 882 | code: "YDYE", 883 | name: "Yemen, Democratic", 884 | former: CountryCode { 885 | name: "Yemen, Democratic", 886 | alpha2: "YD", 887 | alpha3: "YMD", 888 | numeric: 720, 889 | }, 890 | validity: &[1974,1990], 891 | desc: "Merged into Yemen ", 892 | new_countries: &[ 893 | 894 | CountryCode { 895 | name: "Yemen", 896 | alpha2: "YE", 897 | alpha3: "YEM", 898 | numeric: 887, 899 | }, 900 | 901 | ], 902 | }; 903 | 904 | 905 | pub const YUCS: CountryCode3 = CountryCode3 { 906 | code: "YUCS", 907 | name: "Yugoslavia", 908 | former: CountryCode { 909 | name: "Yugoslavia", 910 | alpha2: "YU", 911 | alpha3: "YUG", 912 | numeric: 891, 913 | }, 914 | validity: &[1974,2003], 915 | desc: "Name changed to Serbia and Montenegro ", 916 | new_countries: &[ 917 | 918 | CountryCode { 919 | name: "Serbia and Montenegro", 920 | alpha2: "CS", 921 | alpha3: "SCG", 922 | numeric: 891, 923 | }, 924 | 925 | ], 926 | }; 927 | 928 | 929 | pub const ZRCD: CountryCode3 = CountryCode3 { 930 | code: "ZRCD", 931 | name: "Zaire", 932 | former: CountryCode { 933 | name: "Zaire", 934 | alpha2: "ZR", 935 | alpha3: "ZAR", 936 | numeric: 180, 937 | }, 938 | validity: &[1974,1997], 939 | desc: "Name changed to Congo, Democratic Republic of the ", 940 | new_countries: &[ 941 | 942 | CountryCode { 943 | name: "Congo, Democratic Republic of the", 944 | alpha2: "CD", 945 | alpha3: "COD", 946 | numeric: 180, 947 | }, 948 | 949 | ], 950 | }; 951 | 952 | 953 | /// Returns the CountryCode3 with the given Alpha4 code, if exists. 954 | /// #Sample 955 | /// ``` 956 | /// let sub = rust_iso3166::iso3166_3::from_code("PZPA"); 957 | /// assert_eq!("Panama Canal Zone", sub.unwrap().name); 958 | /// ``` 959 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen(js_name = from_code_iso_3166_3))] 960 | pub fn from_code(alpha4: &str) -> Option { 961 | ALPHA4_MAP.get(alpha4).cloned() 962 | } 963 | 964 | 965 | ///CountryCode map with alpha4 Code key 966 | pub const ALPHA4_MAP: Map<&str, CountryCode3> = phf_map! { 967 | 968 | "BQAQ" => BQAQ, 969 | "BUMM" => BUMM, 970 | "BYAA" => BYAA, 971 | "CTKI" => CTKI, 972 | "CSHH" => CSHH, 973 | "DYBJ" => DYBJ, 974 | "NQAQ" => NQAQ, 975 | "TPTL" => TPTL, 976 | "FXFR" => FXFR, 977 | "AIDJ" => AIDJ, 978 | "FQHH" => FQHH, 979 | "DDDE" => DDDE, 980 | "GEHH" => GEHH, 981 | "JTUM" => JTUM, 982 | "MIUM" => MIUM, 983 | "ANHH" => ANHH, 984 | "NTHH" => NTHH, 985 | "NHVU" => NHVU, 986 | "PCHH" => PCHH, 987 | "PZPA" => PZPA, 988 | "CSXX" => CSXX, 989 | "SKIN" => SKIN, 990 | "RHZW" => RHZW, 991 | "PUUM" => PUUM, 992 | "HVBF" => HVBF, 993 | "SUHH" => SUHH, 994 | "VDVN" => VDVN, 995 | "WKUM" => WKUM, 996 | "YDYE" => YDYE, 997 | "YUCS" => YUCS, 998 | "ZRCD" => ZRCD, 999 | 1000 | }; 1001 | 1002 | 1003 | ///ALL the Countrys struct 1004 | pub const ALL: & [CountryCode3] = &[ 1005 | 1006 | BQAQ, 1007 | BUMM, 1008 | BYAA, 1009 | CTKI, 1010 | CSHH, 1011 | DYBJ, 1012 | NQAQ, 1013 | TPTL, 1014 | FXFR, 1015 | AIDJ, 1016 | FQHH, 1017 | DDDE, 1018 | GEHH, 1019 | JTUM, 1020 | MIUM, 1021 | ANHH, 1022 | NTHH, 1023 | NHVU, 1024 | PCHH, 1025 | PZPA, 1026 | CSXX, 1027 | SKIN, 1028 | RHZW, 1029 | PUUM, 1030 | HVBF, 1031 | SUHH, 1032 | VDVN, 1033 | WKUM, 1034 | YDYE, 1035 | YUCS, 1036 | ZRCD, 1037 | 1038 | ]; 1039 | 1040 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | 2 | use phf::phf_map; 3 | use phf::Map; 4 | pub mod iso3166_2; 5 | pub mod iso3166_3; 6 | use std::hash::Hash; 7 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 8 | use wasm_bindgen::prelude::*; 9 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 10 | use js_sys::Array; 11 | 12 | /// # Sample code 13 | /// ``` 14 | /// let country = rust_iso3166::from_alpha2("AU"); 15 | /// assert_eq!("AUS", country.unwrap().alpha3); 16 | /// let country = rust_iso3166::from_alpha3("AUS"); 17 | /// assert_eq!("AU", country.unwrap().alpha2); 18 | /// let country = rust_iso3166::from_numeric(036); 19 | /// assert_eq!("AUS", country.unwrap().alpha3); 20 | /// let country = rust_iso3166::from_numeric_str("036"); 21 | /// assert_eq!("AUS", country.unwrap().alpha3); 22 | /// 23 | /// println!("{:?}", country); 24 | /// println!("{:?}", rust_iso3166::ALL); 25 | 26 | /// println!("{:?}", rust_iso3166::ALL_ALPHA2); 27 | /// println!("{:?}", rust_iso3166::ALL_ALPHA3); 28 | /// println!("{:?}", rust_iso3166::ALL_NAME); 29 | /// println!("{:?}", rust_iso3166::ALL_NUMERIC); 30 | /// println!("{:?}", rust_iso3166::ALL_NUMERIC_STR); 31 | 32 | /// println!("{:?}", rust_iso3166::NUMERIC_MAP); 33 | /// println!("{:?}", rust_iso3166::ALPHA3_MAP); 34 | /// println!("{:?}", rust_iso3166::ALPHA2_MAP); 35 | /// ``` 36 | 37 | /// Data for each Country Code defined by ISO 3166-1 38 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 39 | #[wasm_bindgen] 40 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 41 | pub struct CountryCode { 42 | ///English short name 43 | name: &'static str, 44 | ///Alpha-2 code 45 | alpha2: &'static str, 46 | ///Alpha-3 code 47 | alpha3: &'static str, 48 | ///Numeric code 49 | numeric: i32, 50 | } 51 | 52 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 53 | #[derive(Debug, Ord, PartialOrd, Copy, Clone, PartialEq, Eq, Hash)] 54 | pub struct CountryCode { 55 | ///English short name 56 | pub name: &'static str, 57 | ///Alpha-2 code 58 | pub alpha2: &'static str, 59 | ///Alpha-3 code 60 | pub alpha3: &'static str, 61 | ///Numeric code 62 | pub numeric: i32, 63 | } 64 | 65 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 66 | impl CountryCode { 67 | 68 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 69 | #[wasm_bindgen(getter)] 70 | pub fn name(&self) -> String { 71 | self.name.into() 72 | } 73 | 74 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 75 | #[wasm_bindgen(getter)] 76 | pub fn alpha2(&self) -> String { 77 | self.alpha2.into() 78 | } 79 | 80 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 81 | #[wasm_bindgen(getter)] 82 | pub fn alpha3(&self) -> String { 83 | self.alpha3.into() 84 | } 85 | 86 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 87 | #[wasm_bindgen(getter)] 88 | pub fn numeric(&self) -> i32 { 89 | self.numeric 90 | } 91 | 92 | ///Return len 3 String for CountryCode numeric 93 | pub fn numeric_str (&self) -> String { 94 | format!("{:03}", self.numeric) 95 | } 96 | 97 | ///Return Subdivision for ISO 3166-2 98 | #[cfg(any(not(direct_wasm),not(target_arch = "wasm32")))] 99 | pub fn subdivisions (&self) -> Option<&[iso3166_2::Subdivision]> { 100 | iso3166_2::SUBDIVISION_COUNTRY_MAP.get(self.alpha2).cloned() 101 | } 102 | 103 | #[cfg(all(direct_wasm,target_arch = "wasm32"))] 104 | pub fn subdivisions (&self) -> Array { 105 | let ps = iso3166_2::SUBDIVISION_COUNTRY_MAP.get(self.alpha2).cloned(); 106 | let mut vector: Vec = Vec::new(); 107 | match ps { 108 | Some(p) => { 109 | for i in 0..p.len() { 110 | vector.push(p[i]) 111 | } 112 | }, 113 | None => { 114 | 115 | }, 116 | } 117 | 118 | vector.into_iter().map(JsValue::from).collect() 119 | } 120 | } 121 | /// Returns the CountryCode with the given Alpha2 code, if exists. 122 | /// #Sample 123 | /// ``` 124 | /// let country = rust_iso3166::from_alpha2("AU"); 125 | /// assert_eq!("AUS", country.unwrap().alpha3); 126 | /// ``` 127 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 128 | pub fn from_alpha2(alpha2: &str) -> Option { 129 | ALPHA2_MAP.get(alpha2).cloned() 130 | } 131 | 132 | /// Returns the CountryCode with the given Alpha3 code, if exists. 133 | /// #Sample 134 | /// ``` 135 | /// let country = rust_iso3166::from_alpha3("AUS"); 136 | /// assert_eq!(036, country.unwrap().numeric); 137 | /// ``` 138 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 139 | pub fn from_alpha3(alpha3: &str) -> Option { 140 | ALPHA3_MAP.get(alpha3).cloned() 141 | } 142 | 143 | /// Returns the CountryCode with the given numeric , if exists. 144 | // #Sample 145 | /// ``` 146 | /// let country = rust_iso3166::from_numeric(036); 147 | /// assert_eq!("AUS", country.unwrap().alpha3); 148 | /// ``` 149 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 150 | pub fn from_numeric(numeric: i32) -> Option { 151 | let k = format!("{:03}", numeric); 152 | NUMERIC_MAP.get(&k).cloned() 153 | } 154 | 155 | /// Returns the CountryCode with the given numeric 3 length str, if exists. 156 | // #Sample 157 | /// ``` 158 | /// let country = rust_iso3166::from_numeric_str("036"); 159 | /// assert_eq!("AUS", country.unwrap().alpha3); 160 | /// ``` 161 | #[cfg_attr(all(direct_wasm,target_arch = "wasm32"), wasm_bindgen)] 162 | pub fn from_numeric_str(numeric: &str) -> Option { 163 | NUMERIC_MAP.get(numeric).cloned() 164 | } 165 | 166 | 167 | 168 | pub const AF: CountryCode = CountryCode { 169 | name: "Afghanistan", 170 | alpha2: "AF", 171 | alpha3: "AFG", 172 | numeric: 4, 173 | }; 174 | 175 | 176 | pub const AX: CountryCode = CountryCode { 177 | name: "Åland Islands", 178 | alpha2: "AX", 179 | alpha3: "ALA", 180 | numeric: 248, 181 | }; 182 | 183 | 184 | pub const AL: CountryCode = CountryCode { 185 | name: "Albania", 186 | alpha2: "AL", 187 | alpha3: "ALB", 188 | numeric: 8, 189 | }; 190 | 191 | 192 | pub const DZ: CountryCode = CountryCode { 193 | name: "Algeria", 194 | alpha2: "DZ", 195 | alpha3: "DZA", 196 | numeric: 12, 197 | }; 198 | 199 | 200 | pub const AS: CountryCode = CountryCode { 201 | name: "American Samoa", 202 | alpha2: "AS", 203 | alpha3: "ASM", 204 | numeric: 16, 205 | }; 206 | 207 | 208 | pub const AD: CountryCode = CountryCode { 209 | name: "Andorra", 210 | alpha2: "AD", 211 | alpha3: "AND", 212 | numeric: 20, 213 | }; 214 | 215 | 216 | pub const AO: CountryCode = CountryCode { 217 | name: "Angola", 218 | alpha2: "AO", 219 | alpha3: "AGO", 220 | numeric: 24, 221 | }; 222 | 223 | 224 | pub const AI: CountryCode = CountryCode { 225 | name: "Anguilla", 226 | alpha2: "AI", 227 | alpha3: "AIA", 228 | numeric: 660, 229 | }; 230 | 231 | 232 | pub const AQ: CountryCode = CountryCode { 233 | name: "Antarctica", 234 | alpha2: "AQ", 235 | alpha3: "ATA", 236 | numeric: 10, 237 | }; 238 | 239 | 240 | pub const AG: CountryCode = CountryCode { 241 | name: "Antigua and Barbuda", 242 | alpha2: "AG", 243 | alpha3: "ATG", 244 | numeric: 28, 245 | }; 246 | 247 | 248 | pub const AR: CountryCode = CountryCode { 249 | name: "Argentina", 250 | alpha2: "AR", 251 | alpha3: "ARG", 252 | numeric: 32, 253 | }; 254 | 255 | 256 | pub const AM: CountryCode = CountryCode { 257 | name: "Armenia", 258 | alpha2: "AM", 259 | alpha3: "ARM", 260 | numeric: 51, 261 | }; 262 | 263 | 264 | pub const AW: CountryCode = CountryCode { 265 | name: "Aruba", 266 | alpha2: "AW", 267 | alpha3: "ABW", 268 | numeric: 533, 269 | }; 270 | 271 | 272 | pub const AU: CountryCode = CountryCode { 273 | name: "Australia", 274 | alpha2: "AU", 275 | alpha3: "AUS", 276 | numeric: 36, 277 | }; 278 | 279 | 280 | pub const AT: CountryCode = CountryCode { 281 | name: "Austria", 282 | alpha2: "AT", 283 | alpha3: "AUT", 284 | numeric: 40, 285 | }; 286 | 287 | 288 | pub const AZ: CountryCode = CountryCode { 289 | name: "Azerbaijan", 290 | alpha2: "AZ", 291 | alpha3: "AZE", 292 | numeric: 31, 293 | }; 294 | 295 | 296 | pub const BS: CountryCode = CountryCode { 297 | name: "Bahamas", 298 | alpha2: "BS", 299 | alpha3: "BHS", 300 | numeric: 44, 301 | }; 302 | 303 | 304 | pub const BH: CountryCode = CountryCode { 305 | name: "Bahrain", 306 | alpha2: "BH", 307 | alpha3: "BHR", 308 | numeric: 48, 309 | }; 310 | 311 | 312 | pub const BD: CountryCode = CountryCode { 313 | name: "Bangladesh", 314 | alpha2: "BD", 315 | alpha3: "BGD", 316 | numeric: 50, 317 | }; 318 | 319 | 320 | pub const BB: CountryCode = CountryCode { 321 | name: "Barbados", 322 | alpha2: "BB", 323 | alpha3: "BRB", 324 | numeric: 52, 325 | }; 326 | 327 | 328 | pub const BY: CountryCode = CountryCode { 329 | name: "Belarus", 330 | alpha2: "BY", 331 | alpha3: "BLR", 332 | numeric: 112, 333 | }; 334 | 335 | 336 | pub const BE: CountryCode = CountryCode { 337 | name: "Belgium", 338 | alpha2: "BE", 339 | alpha3: "BEL", 340 | numeric: 56, 341 | }; 342 | 343 | 344 | pub const BZ: CountryCode = CountryCode { 345 | name: "Belize", 346 | alpha2: "BZ", 347 | alpha3: "BLZ", 348 | numeric: 84, 349 | }; 350 | 351 | 352 | pub const BJ: CountryCode = CountryCode { 353 | name: "Benin", 354 | alpha2: "BJ", 355 | alpha3: "BEN", 356 | numeric: 204, 357 | }; 358 | 359 | 360 | pub const BM: CountryCode = CountryCode { 361 | name: "Bermuda", 362 | alpha2: "BM", 363 | alpha3: "BMU", 364 | numeric: 60, 365 | }; 366 | 367 | 368 | pub const BT: CountryCode = CountryCode { 369 | name: "Bhutan", 370 | alpha2: "BT", 371 | alpha3: "BTN", 372 | numeric: 64, 373 | }; 374 | 375 | 376 | pub const BO: CountryCode = CountryCode { 377 | name: "Bolivia (Plurinational State of)", 378 | alpha2: "BO", 379 | alpha3: "BOL", 380 | numeric: 68, 381 | }; 382 | 383 | 384 | pub const BQ: CountryCode = CountryCode { 385 | name: "Bonaire, Sint Eustatius and Saba[c]", 386 | alpha2: "BQ", 387 | alpha3: "BES", 388 | numeric: 535, 389 | }; 390 | 391 | 392 | pub const BA: CountryCode = CountryCode { 393 | name: "Bosnia and Herzegovina", 394 | alpha2: "BA", 395 | alpha3: "BIH", 396 | numeric: 70, 397 | }; 398 | 399 | 400 | pub const BW: CountryCode = CountryCode { 401 | name: "Botswana", 402 | alpha2: "BW", 403 | alpha3: "BWA", 404 | numeric: 72, 405 | }; 406 | 407 | 408 | pub const BV: CountryCode = CountryCode { 409 | name: "Bouvet Island", 410 | alpha2: "BV", 411 | alpha3: "BVT", 412 | numeric: 74, 413 | }; 414 | 415 | 416 | pub const BR: CountryCode = CountryCode { 417 | name: "Brazil", 418 | alpha2: "BR", 419 | alpha3: "BRA", 420 | numeric: 76, 421 | }; 422 | 423 | 424 | pub const IO: CountryCode = CountryCode { 425 | name: "British Indian Ocean Territory", 426 | alpha2: "IO", 427 | alpha3: "IOT", 428 | numeric: 86, 429 | }; 430 | 431 | 432 | pub const BN: CountryCode = CountryCode { 433 | name: "Brunei Darussalam", 434 | alpha2: "BN", 435 | alpha3: "BRN", 436 | numeric: 96, 437 | }; 438 | 439 | 440 | pub const BG: CountryCode = CountryCode { 441 | name: "Bulgaria", 442 | alpha2: "BG", 443 | alpha3: "BGR", 444 | numeric: 100, 445 | }; 446 | 447 | 448 | pub const BF: CountryCode = CountryCode { 449 | name: "Burkina Faso", 450 | alpha2: "BF", 451 | alpha3: "BFA", 452 | numeric: 854, 453 | }; 454 | 455 | 456 | pub const BI: CountryCode = CountryCode { 457 | name: "Burundi", 458 | alpha2: "BI", 459 | alpha3: "BDI", 460 | numeric: 108, 461 | }; 462 | 463 | 464 | pub const CV: CountryCode = CountryCode { 465 | name: "Cabo Verde", 466 | alpha2: "CV", 467 | alpha3: "CPV", 468 | numeric: 132, 469 | }; 470 | 471 | 472 | pub const KH: CountryCode = CountryCode { 473 | name: "Cambodia", 474 | alpha2: "KH", 475 | alpha3: "KHM", 476 | numeric: 116, 477 | }; 478 | 479 | 480 | pub const CM: CountryCode = CountryCode { 481 | name: "Cameroon", 482 | alpha2: "CM", 483 | alpha3: "CMR", 484 | numeric: 120, 485 | }; 486 | 487 | 488 | pub const CA: CountryCode = CountryCode { 489 | name: "Canada", 490 | alpha2: "CA", 491 | alpha3: "CAN", 492 | numeric: 124, 493 | }; 494 | 495 | 496 | pub const KY: CountryCode = CountryCode { 497 | name: "Cayman Islands", 498 | alpha2: "KY", 499 | alpha3: "CYM", 500 | numeric: 136, 501 | }; 502 | 503 | 504 | pub const CF: CountryCode = CountryCode { 505 | name: "Central African Republic", 506 | alpha2: "CF", 507 | alpha3: "CAF", 508 | numeric: 140, 509 | }; 510 | 511 | 512 | pub const TD: CountryCode = CountryCode { 513 | name: "Chad", 514 | alpha2: "TD", 515 | alpha3: "TCD", 516 | numeric: 148, 517 | }; 518 | 519 | 520 | pub const CL: CountryCode = CountryCode { 521 | name: "Chile", 522 | alpha2: "CL", 523 | alpha3: "CHL", 524 | numeric: 152, 525 | }; 526 | 527 | 528 | pub const CN: CountryCode = CountryCode { 529 | name: "China", 530 | alpha2: "CN", 531 | alpha3: "CHN", 532 | numeric: 156, 533 | }; 534 | 535 | 536 | pub const CX: CountryCode = CountryCode { 537 | name: "Christmas Island", 538 | alpha2: "CX", 539 | alpha3: "CXR", 540 | numeric: 162, 541 | }; 542 | 543 | 544 | pub const CC: CountryCode = CountryCode { 545 | name: "Cocos (Keeling) Islands", 546 | alpha2: "CC", 547 | alpha3: "CCK", 548 | numeric: 166, 549 | }; 550 | 551 | 552 | pub const CO: CountryCode = CountryCode { 553 | name: "Colombia", 554 | alpha2: "CO", 555 | alpha3: "COL", 556 | numeric: 170, 557 | }; 558 | 559 | 560 | pub const KM: CountryCode = CountryCode { 561 | name: "Comoros", 562 | alpha2: "KM", 563 | alpha3: "COM", 564 | numeric: 174, 565 | }; 566 | 567 | 568 | pub const CG: CountryCode = CountryCode { 569 | name: "Congo", 570 | alpha2: "CG", 571 | alpha3: "COG", 572 | numeric: 178, 573 | }; 574 | 575 | 576 | pub const CD: CountryCode = CountryCode { 577 | name: "Congo, Democratic Republic of the", 578 | alpha2: "CD", 579 | alpha3: "COD", 580 | numeric: 180, 581 | }; 582 | 583 | 584 | pub const CK: CountryCode = CountryCode { 585 | name: "Cook Islands", 586 | alpha2: "CK", 587 | alpha3: "COK", 588 | numeric: 184, 589 | }; 590 | 591 | 592 | pub const CR: CountryCode = CountryCode { 593 | name: "Costa Rica", 594 | alpha2: "CR", 595 | alpha3: "CRI", 596 | numeric: 188, 597 | }; 598 | 599 | 600 | pub const CI: CountryCode = CountryCode { 601 | name: "Côte d'Ivoire", 602 | alpha2: "CI", 603 | alpha3: "CIV", 604 | numeric: 384, 605 | }; 606 | 607 | 608 | pub const HR: CountryCode = CountryCode { 609 | name: "Croatia", 610 | alpha2: "HR", 611 | alpha3: "HRV", 612 | numeric: 191, 613 | }; 614 | 615 | 616 | pub const CU: CountryCode = CountryCode { 617 | name: "Cuba", 618 | alpha2: "CU", 619 | alpha3: "CUB", 620 | numeric: 192, 621 | }; 622 | 623 | 624 | pub const CW: CountryCode = CountryCode { 625 | name: "Curaçao", 626 | alpha2: "CW", 627 | alpha3: "CUW", 628 | numeric: 531, 629 | }; 630 | 631 | 632 | pub const CY: CountryCode = CountryCode { 633 | name: "Cyprus", 634 | alpha2: "CY", 635 | alpha3: "CYP", 636 | numeric: 196, 637 | }; 638 | 639 | 640 | pub const CZ: CountryCode = CountryCode { 641 | name: "Czechia", 642 | alpha2: "CZ", 643 | alpha3: "CZE", 644 | numeric: 203, 645 | }; 646 | 647 | 648 | pub const DK: CountryCode = CountryCode { 649 | name: "Denmark", 650 | alpha2: "DK", 651 | alpha3: "DNK", 652 | numeric: 208, 653 | }; 654 | 655 | 656 | pub const DJ: CountryCode = CountryCode { 657 | name: "Djibouti", 658 | alpha2: "DJ", 659 | alpha3: "DJI", 660 | numeric: 262, 661 | }; 662 | 663 | 664 | pub const DM: CountryCode = CountryCode { 665 | name: "Dominica", 666 | alpha2: "DM", 667 | alpha3: "DMA", 668 | numeric: 212, 669 | }; 670 | 671 | 672 | pub const DO: CountryCode = CountryCode { 673 | name: "Dominican Republic", 674 | alpha2: "DO", 675 | alpha3: "DOM", 676 | numeric: 214, 677 | }; 678 | 679 | 680 | pub const EC: CountryCode = CountryCode { 681 | name: "Ecuador", 682 | alpha2: "EC", 683 | alpha3: "ECU", 684 | numeric: 218, 685 | }; 686 | 687 | 688 | pub const EG: CountryCode = CountryCode { 689 | name: "Egypt", 690 | alpha2: "EG", 691 | alpha3: "EGY", 692 | numeric: 818, 693 | }; 694 | 695 | 696 | pub const SV: CountryCode = CountryCode { 697 | name: "El Salvador", 698 | alpha2: "SV", 699 | alpha3: "SLV", 700 | numeric: 222, 701 | }; 702 | 703 | 704 | pub const GQ: CountryCode = CountryCode { 705 | name: "Equatorial Guinea", 706 | alpha2: "GQ", 707 | alpha3: "GNQ", 708 | numeric: 226, 709 | }; 710 | 711 | 712 | pub const ER: CountryCode = CountryCode { 713 | name: "Eritrea", 714 | alpha2: "ER", 715 | alpha3: "ERI", 716 | numeric: 232, 717 | }; 718 | 719 | 720 | pub const EE: CountryCode = CountryCode { 721 | name: "Estonia", 722 | alpha2: "EE", 723 | alpha3: "EST", 724 | numeric: 233, 725 | }; 726 | 727 | 728 | pub const SZ: CountryCode = CountryCode { 729 | name: "Eswatini", 730 | alpha2: "SZ", 731 | alpha3: "SWZ", 732 | numeric: 748, 733 | }; 734 | 735 | 736 | pub const ET: CountryCode = CountryCode { 737 | name: "Ethiopia", 738 | alpha2: "ET", 739 | alpha3: "ETH", 740 | numeric: 231, 741 | }; 742 | 743 | 744 | pub const FK: CountryCode = CountryCode { 745 | name: "Falkland Islands (Malvinas)", 746 | alpha2: "FK", 747 | alpha3: "FLK", 748 | numeric: 238, 749 | }; 750 | 751 | 752 | pub const FO: CountryCode = CountryCode { 753 | name: "Faroe Islands", 754 | alpha2: "FO", 755 | alpha3: "FRO", 756 | numeric: 234, 757 | }; 758 | 759 | 760 | pub const FJ: CountryCode = CountryCode { 761 | name: "Fiji", 762 | alpha2: "FJ", 763 | alpha3: "FJI", 764 | numeric: 242, 765 | }; 766 | 767 | 768 | pub const FI: CountryCode = CountryCode { 769 | name: "Finland", 770 | alpha2: "FI", 771 | alpha3: "FIN", 772 | numeric: 246, 773 | }; 774 | 775 | 776 | pub const FR: CountryCode = CountryCode { 777 | name: "France", 778 | alpha2: "FR", 779 | alpha3: "FRA", 780 | numeric: 250, 781 | }; 782 | 783 | 784 | pub const GF: CountryCode = CountryCode { 785 | name: "French Guiana", 786 | alpha2: "GF", 787 | alpha3: "GUF", 788 | numeric: 254, 789 | }; 790 | 791 | 792 | pub const PF: CountryCode = CountryCode { 793 | name: "French Polynesia", 794 | alpha2: "PF", 795 | alpha3: "PYF", 796 | numeric: 258, 797 | }; 798 | 799 | 800 | pub const TF: CountryCode = CountryCode { 801 | name: "French Southern Territories", 802 | alpha2: "TF", 803 | alpha3: "ATF", 804 | numeric: 260, 805 | }; 806 | 807 | 808 | pub const GA: CountryCode = CountryCode { 809 | name: "Gabon", 810 | alpha2: "GA", 811 | alpha3: "GAB", 812 | numeric: 266, 813 | }; 814 | 815 | 816 | pub const GM: CountryCode = CountryCode { 817 | name: "Gambia", 818 | alpha2: "GM", 819 | alpha3: "GMB", 820 | numeric: 270, 821 | }; 822 | 823 | 824 | pub const GE: CountryCode = CountryCode { 825 | name: "Georgia", 826 | alpha2: "GE", 827 | alpha3: "GEO", 828 | numeric: 268, 829 | }; 830 | 831 | 832 | pub const DE: CountryCode = CountryCode { 833 | name: "Germany", 834 | alpha2: "DE", 835 | alpha3: "DEU", 836 | numeric: 276, 837 | }; 838 | 839 | 840 | pub const GH: CountryCode = CountryCode { 841 | name: "Ghana", 842 | alpha2: "GH", 843 | alpha3: "GHA", 844 | numeric: 288, 845 | }; 846 | 847 | 848 | pub const GI: CountryCode = CountryCode { 849 | name: "Gibraltar", 850 | alpha2: "GI", 851 | alpha3: "GIB", 852 | numeric: 292, 853 | }; 854 | 855 | 856 | pub const GR: CountryCode = CountryCode { 857 | name: "Greece", 858 | alpha2: "GR", 859 | alpha3: "GRC", 860 | numeric: 300, 861 | }; 862 | 863 | 864 | pub const GL: CountryCode = CountryCode { 865 | name: "Greenland", 866 | alpha2: "GL", 867 | alpha3: "GRL", 868 | numeric: 304, 869 | }; 870 | 871 | 872 | pub const GD: CountryCode = CountryCode { 873 | name: "Grenada", 874 | alpha2: "GD", 875 | alpha3: "GRD", 876 | numeric: 308, 877 | }; 878 | 879 | 880 | pub const GP: CountryCode = CountryCode { 881 | name: "Guadeloupe", 882 | alpha2: "GP", 883 | alpha3: "GLP", 884 | numeric: 312, 885 | }; 886 | 887 | 888 | pub const GU: CountryCode = CountryCode { 889 | name: "Guam", 890 | alpha2: "GU", 891 | alpha3: "GUM", 892 | numeric: 316, 893 | }; 894 | 895 | 896 | pub const GT: CountryCode = CountryCode { 897 | name: "Guatemala", 898 | alpha2: "GT", 899 | alpha3: "GTM", 900 | numeric: 320, 901 | }; 902 | 903 | 904 | pub const GG: CountryCode = CountryCode { 905 | name: "Guernsey", 906 | alpha2: "GG", 907 | alpha3: "GGY", 908 | numeric: 831, 909 | }; 910 | 911 | 912 | pub const GN: CountryCode = CountryCode { 913 | name: "Guinea", 914 | alpha2: "GN", 915 | alpha3: "GIN", 916 | numeric: 324, 917 | }; 918 | 919 | 920 | pub const GW: CountryCode = CountryCode { 921 | name: "Guinea-Bissau", 922 | alpha2: "GW", 923 | alpha3: "GNB", 924 | numeric: 624, 925 | }; 926 | 927 | 928 | pub const GY: CountryCode = CountryCode { 929 | name: "Guyana", 930 | alpha2: "GY", 931 | alpha3: "GUY", 932 | numeric: 328, 933 | }; 934 | 935 | 936 | pub const HT: CountryCode = CountryCode { 937 | name: "Haiti", 938 | alpha2: "HT", 939 | alpha3: "HTI", 940 | numeric: 332, 941 | }; 942 | 943 | 944 | pub const HM: CountryCode = CountryCode { 945 | name: "Heard Island and McDonald Islands", 946 | alpha2: "HM", 947 | alpha3: "HMD", 948 | numeric: 334, 949 | }; 950 | 951 | 952 | pub const VA: CountryCode = CountryCode { 953 | name: "Holy See", 954 | alpha2: "VA", 955 | alpha3: "VAT", 956 | numeric: 336, 957 | }; 958 | 959 | 960 | pub const HN: CountryCode = CountryCode { 961 | name: "Honduras", 962 | alpha2: "HN", 963 | alpha3: "HND", 964 | numeric: 340, 965 | }; 966 | 967 | 968 | pub const HK: CountryCode = CountryCode { 969 | name: "Hong Kong", 970 | alpha2: "HK", 971 | alpha3: "HKG", 972 | numeric: 344, 973 | }; 974 | 975 | 976 | pub const HU: CountryCode = CountryCode { 977 | name: "Hungary", 978 | alpha2: "HU", 979 | alpha3: "HUN", 980 | numeric: 348, 981 | }; 982 | 983 | 984 | pub const IS: CountryCode = CountryCode { 985 | name: "Iceland", 986 | alpha2: "IS", 987 | alpha3: "ISL", 988 | numeric: 352, 989 | }; 990 | 991 | 992 | pub const IN: CountryCode = CountryCode { 993 | name: "India", 994 | alpha2: "IN", 995 | alpha3: "IND", 996 | numeric: 356, 997 | }; 998 | 999 | 1000 | pub const ID: CountryCode = CountryCode { 1001 | name: "Indonesia", 1002 | alpha2: "ID", 1003 | alpha3: "IDN", 1004 | numeric: 360, 1005 | }; 1006 | 1007 | 1008 | pub const IR: CountryCode = CountryCode { 1009 | name: "Iran (Islamic Republic of)", 1010 | alpha2: "IR", 1011 | alpha3: "IRN", 1012 | numeric: 364, 1013 | }; 1014 | 1015 | 1016 | pub const IQ: CountryCode = CountryCode { 1017 | name: "Iraq", 1018 | alpha2: "IQ", 1019 | alpha3: "IRQ", 1020 | numeric: 368, 1021 | }; 1022 | 1023 | 1024 | pub const IE: CountryCode = CountryCode { 1025 | name: "Ireland", 1026 | alpha2: "IE", 1027 | alpha3: "IRL", 1028 | numeric: 372, 1029 | }; 1030 | 1031 | 1032 | pub const IM: CountryCode = CountryCode { 1033 | name: "Isle of Man", 1034 | alpha2: "IM", 1035 | alpha3: "IMN", 1036 | numeric: 833, 1037 | }; 1038 | 1039 | 1040 | pub const IL: CountryCode = CountryCode { 1041 | name: "Israel", 1042 | alpha2: "IL", 1043 | alpha3: "ISR", 1044 | numeric: 376, 1045 | }; 1046 | 1047 | 1048 | pub const IT: CountryCode = CountryCode { 1049 | name: "Italy", 1050 | alpha2: "IT", 1051 | alpha3: "ITA", 1052 | numeric: 380, 1053 | }; 1054 | 1055 | 1056 | pub const JM: CountryCode = CountryCode { 1057 | name: "Jamaica", 1058 | alpha2: "JM", 1059 | alpha3: "JAM", 1060 | numeric: 388, 1061 | }; 1062 | 1063 | 1064 | pub const JP: CountryCode = CountryCode { 1065 | name: "Japan", 1066 | alpha2: "JP", 1067 | alpha3: "JPN", 1068 | numeric: 392, 1069 | }; 1070 | 1071 | 1072 | pub const JE: CountryCode = CountryCode { 1073 | name: "Jersey", 1074 | alpha2: "JE", 1075 | alpha3: "JEY", 1076 | numeric: 832, 1077 | }; 1078 | 1079 | 1080 | pub const JO: CountryCode = CountryCode { 1081 | name: "Jordan", 1082 | alpha2: "JO", 1083 | alpha3: "JOR", 1084 | numeric: 400, 1085 | }; 1086 | 1087 | 1088 | pub const KZ: CountryCode = CountryCode { 1089 | name: "Kazakhstan", 1090 | alpha2: "KZ", 1091 | alpha3: "KAZ", 1092 | numeric: 398, 1093 | }; 1094 | 1095 | 1096 | pub const KE: CountryCode = CountryCode { 1097 | name: "Kenya", 1098 | alpha2: "KE", 1099 | alpha3: "KEN", 1100 | numeric: 404, 1101 | }; 1102 | 1103 | 1104 | pub const KI: CountryCode = CountryCode { 1105 | name: "Kiribati", 1106 | alpha2: "KI", 1107 | alpha3: "KIR", 1108 | numeric: 296, 1109 | }; 1110 | 1111 | 1112 | pub const KP: CountryCode = CountryCode { 1113 | name: "Korea (Democratic People's Republic of)", 1114 | alpha2: "KP", 1115 | alpha3: "PRK", 1116 | numeric: 408, 1117 | }; 1118 | 1119 | 1120 | pub const KR: CountryCode = CountryCode { 1121 | name: "Korea, Republic of", 1122 | alpha2: "KR", 1123 | alpha3: "KOR", 1124 | numeric: 410, 1125 | }; 1126 | 1127 | 1128 | pub const KW: CountryCode = CountryCode { 1129 | name: "Kuwait", 1130 | alpha2: "KW", 1131 | alpha3: "KWT", 1132 | numeric: 414, 1133 | }; 1134 | 1135 | 1136 | pub const KG: CountryCode = CountryCode { 1137 | name: "Kyrgyzstan", 1138 | alpha2: "KG", 1139 | alpha3: "KGZ", 1140 | numeric: 417, 1141 | }; 1142 | 1143 | 1144 | pub const LA: CountryCode = CountryCode { 1145 | name: "Lao People's Democratic Republic", 1146 | alpha2: "LA", 1147 | alpha3: "LAO", 1148 | numeric: 418, 1149 | }; 1150 | 1151 | 1152 | pub const LV: CountryCode = CountryCode { 1153 | name: "Latvia", 1154 | alpha2: "LV", 1155 | alpha3: "LVA", 1156 | numeric: 428, 1157 | }; 1158 | 1159 | 1160 | pub const LB: CountryCode = CountryCode { 1161 | name: "Lebanon", 1162 | alpha2: "LB", 1163 | alpha3: "LBN", 1164 | numeric: 422, 1165 | }; 1166 | 1167 | 1168 | pub const LS: CountryCode = CountryCode { 1169 | name: "Lesotho", 1170 | alpha2: "LS", 1171 | alpha3: "LSO", 1172 | numeric: 426, 1173 | }; 1174 | 1175 | 1176 | pub const LR: CountryCode = CountryCode { 1177 | name: "Liberia", 1178 | alpha2: "LR", 1179 | alpha3: "LBR", 1180 | numeric: 430, 1181 | }; 1182 | 1183 | 1184 | pub const LY: CountryCode = CountryCode { 1185 | name: "Libya", 1186 | alpha2: "LY", 1187 | alpha3: "LBY", 1188 | numeric: 434, 1189 | }; 1190 | 1191 | 1192 | pub const LI: CountryCode = CountryCode { 1193 | name: "Liechtenstein", 1194 | alpha2: "LI", 1195 | alpha3: "LIE", 1196 | numeric: 438, 1197 | }; 1198 | 1199 | 1200 | pub const LT: CountryCode = CountryCode { 1201 | name: "Lithuania", 1202 | alpha2: "LT", 1203 | alpha3: "LTU", 1204 | numeric: 440, 1205 | }; 1206 | 1207 | 1208 | pub const LU: CountryCode = CountryCode { 1209 | name: "Luxembourg", 1210 | alpha2: "LU", 1211 | alpha3: "LUX", 1212 | numeric: 442, 1213 | }; 1214 | 1215 | 1216 | pub const MO: CountryCode = CountryCode { 1217 | name: "Macao", 1218 | alpha2: "MO", 1219 | alpha3: "MAC", 1220 | numeric: 446, 1221 | }; 1222 | 1223 | 1224 | pub const MG: CountryCode = CountryCode { 1225 | name: "Madagascar", 1226 | alpha2: "MG", 1227 | alpha3: "MDG", 1228 | numeric: 450, 1229 | }; 1230 | 1231 | 1232 | pub const MW: CountryCode = CountryCode { 1233 | name: "Malawi", 1234 | alpha2: "MW", 1235 | alpha3: "MWI", 1236 | numeric: 454, 1237 | }; 1238 | 1239 | 1240 | pub const MY: CountryCode = CountryCode { 1241 | name: "Malaysia", 1242 | alpha2: "MY", 1243 | alpha3: "MYS", 1244 | numeric: 458, 1245 | }; 1246 | 1247 | 1248 | pub const MV: CountryCode = CountryCode { 1249 | name: "Maldives", 1250 | alpha2: "MV", 1251 | alpha3: "MDV", 1252 | numeric: 462, 1253 | }; 1254 | 1255 | 1256 | pub const ML: CountryCode = CountryCode { 1257 | name: "Mali", 1258 | alpha2: "ML", 1259 | alpha3: "MLI", 1260 | numeric: 466, 1261 | }; 1262 | 1263 | 1264 | pub const MT: CountryCode = CountryCode { 1265 | name: "Malta", 1266 | alpha2: "MT", 1267 | alpha3: "MLT", 1268 | numeric: 470, 1269 | }; 1270 | 1271 | 1272 | pub const MH: CountryCode = CountryCode { 1273 | name: "Marshall Islands", 1274 | alpha2: "MH", 1275 | alpha3: "MHL", 1276 | numeric: 584, 1277 | }; 1278 | 1279 | 1280 | pub const MQ: CountryCode = CountryCode { 1281 | name: "Martinique", 1282 | alpha2: "MQ", 1283 | alpha3: "MTQ", 1284 | numeric: 474, 1285 | }; 1286 | 1287 | 1288 | pub const MR: CountryCode = CountryCode { 1289 | name: "Mauritania", 1290 | alpha2: "MR", 1291 | alpha3: "MRT", 1292 | numeric: 478, 1293 | }; 1294 | 1295 | 1296 | pub const MU: CountryCode = CountryCode { 1297 | name: "Mauritius", 1298 | alpha2: "MU", 1299 | alpha3: "MUS", 1300 | numeric: 480, 1301 | }; 1302 | 1303 | 1304 | pub const YT: CountryCode = CountryCode { 1305 | name: "Mayotte", 1306 | alpha2: "YT", 1307 | alpha3: "MYT", 1308 | numeric: 175, 1309 | }; 1310 | 1311 | 1312 | pub const MX: CountryCode = CountryCode { 1313 | name: "Mexico", 1314 | alpha2: "MX", 1315 | alpha3: "MEX", 1316 | numeric: 484, 1317 | }; 1318 | 1319 | 1320 | pub const FM: CountryCode = CountryCode { 1321 | name: "Micronesia (Federated States of)", 1322 | alpha2: "FM", 1323 | alpha3: "FSM", 1324 | numeric: 583, 1325 | }; 1326 | 1327 | 1328 | pub const MD: CountryCode = CountryCode { 1329 | name: "Moldova, Republic of", 1330 | alpha2: "MD", 1331 | alpha3: "MDA", 1332 | numeric: 498, 1333 | }; 1334 | 1335 | 1336 | pub const MC: CountryCode = CountryCode { 1337 | name: "Monaco", 1338 | alpha2: "MC", 1339 | alpha3: "MCO", 1340 | numeric: 492, 1341 | }; 1342 | 1343 | 1344 | pub const MN: CountryCode = CountryCode { 1345 | name: "Mongolia", 1346 | alpha2: "MN", 1347 | alpha3: "MNG", 1348 | numeric: 496, 1349 | }; 1350 | 1351 | 1352 | pub const ME: CountryCode = CountryCode { 1353 | name: "Montenegro", 1354 | alpha2: "ME", 1355 | alpha3: "MNE", 1356 | numeric: 499, 1357 | }; 1358 | 1359 | 1360 | pub const MS: CountryCode = CountryCode { 1361 | name: "Montserrat", 1362 | alpha2: "MS", 1363 | alpha3: "MSR", 1364 | numeric: 500, 1365 | }; 1366 | 1367 | 1368 | pub const MA: CountryCode = CountryCode { 1369 | name: "Morocco", 1370 | alpha2: "MA", 1371 | alpha3: "MAR", 1372 | numeric: 504, 1373 | }; 1374 | 1375 | 1376 | pub const MZ: CountryCode = CountryCode { 1377 | name: "Mozambique", 1378 | alpha2: "MZ", 1379 | alpha3: "MOZ", 1380 | numeric: 508, 1381 | }; 1382 | 1383 | 1384 | pub const MM: CountryCode = CountryCode { 1385 | name: "Myanmar", 1386 | alpha2: "MM", 1387 | alpha3: "MMR", 1388 | numeric: 104, 1389 | }; 1390 | 1391 | 1392 | pub const NA: CountryCode = CountryCode { 1393 | name: "Namibia", 1394 | alpha2: "NA", 1395 | alpha3: "NAM", 1396 | numeric: 516, 1397 | }; 1398 | 1399 | 1400 | pub const NR: CountryCode = CountryCode { 1401 | name: "Nauru", 1402 | alpha2: "NR", 1403 | alpha3: "NRU", 1404 | numeric: 520, 1405 | }; 1406 | 1407 | 1408 | pub const NP: CountryCode = CountryCode { 1409 | name: "Nepal", 1410 | alpha2: "NP", 1411 | alpha3: "NPL", 1412 | numeric: 524, 1413 | }; 1414 | 1415 | 1416 | pub const NL: CountryCode = CountryCode { 1417 | name: "Netherlands", 1418 | alpha2: "NL", 1419 | alpha3: "NLD", 1420 | numeric: 528, 1421 | }; 1422 | 1423 | 1424 | pub const NC: CountryCode = CountryCode { 1425 | name: "New Caledonia", 1426 | alpha2: "NC", 1427 | alpha3: "NCL", 1428 | numeric: 540, 1429 | }; 1430 | 1431 | 1432 | pub const NZ: CountryCode = CountryCode { 1433 | name: "New Zealand", 1434 | alpha2: "NZ", 1435 | alpha3: "NZL", 1436 | numeric: 554, 1437 | }; 1438 | 1439 | 1440 | pub const NI: CountryCode = CountryCode { 1441 | name: "Nicaragua", 1442 | alpha2: "NI", 1443 | alpha3: "NIC", 1444 | numeric: 558, 1445 | }; 1446 | 1447 | 1448 | pub const NE: CountryCode = CountryCode { 1449 | name: "Niger", 1450 | alpha2: "NE", 1451 | alpha3: "NER", 1452 | numeric: 562, 1453 | }; 1454 | 1455 | 1456 | pub const NG: CountryCode = CountryCode { 1457 | name: "Nigeria", 1458 | alpha2: "NG", 1459 | alpha3: "NGA", 1460 | numeric: 566, 1461 | }; 1462 | 1463 | 1464 | pub const NU: CountryCode = CountryCode { 1465 | name: "Niue", 1466 | alpha2: "NU", 1467 | alpha3: "NIU", 1468 | numeric: 570, 1469 | }; 1470 | 1471 | 1472 | pub const NF: CountryCode = CountryCode { 1473 | name: "Norfolk Island", 1474 | alpha2: "NF", 1475 | alpha3: "NFK", 1476 | numeric: 574, 1477 | }; 1478 | 1479 | 1480 | pub const MK: CountryCode = CountryCode { 1481 | name: "North Macedonia", 1482 | alpha2: "MK", 1483 | alpha3: "MKD", 1484 | numeric: 807, 1485 | }; 1486 | 1487 | 1488 | pub const MP: CountryCode = CountryCode { 1489 | name: "Northern Mariana Islands", 1490 | alpha2: "MP", 1491 | alpha3: "MNP", 1492 | numeric: 580, 1493 | }; 1494 | 1495 | 1496 | pub const NO: CountryCode = CountryCode { 1497 | name: "Norway", 1498 | alpha2: "NO", 1499 | alpha3: "NOR", 1500 | numeric: 578, 1501 | }; 1502 | 1503 | 1504 | pub const OM: CountryCode = CountryCode { 1505 | name: "Oman", 1506 | alpha2: "OM", 1507 | alpha3: "OMN", 1508 | numeric: 512, 1509 | }; 1510 | 1511 | 1512 | pub const PK: CountryCode = CountryCode { 1513 | name: "Pakistan", 1514 | alpha2: "PK", 1515 | alpha3: "PAK", 1516 | numeric: 586, 1517 | }; 1518 | 1519 | 1520 | pub const PW: CountryCode = CountryCode { 1521 | name: "Palau", 1522 | alpha2: "PW", 1523 | alpha3: "PLW", 1524 | numeric: 585, 1525 | }; 1526 | 1527 | 1528 | pub const PS: CountryCode = CountryCode { 1529 | name: "Palestine, State of", 1530 | alpha2: "PS", 1531 | alpha3: "PSE", 1532 | numeric: 275, 1533 | }; 1534 | 1535 | 1536 | pub const PA: CountryCode = CountryCode { 1537 | name: "Panama", 1538 | alpha2: "PA", 1539 | alpha3: "PAN", 1540 | numeric: 591, 1541 | }; 1542 | 1543 | 1544 | pub const PG: CountryCode = CountryCode { 1545 | name: "Papua New Guinea", 1546 | alpha2: "PG", 1547 | alpha3: "PNG", 1548 | numeric: 598, 1549 | }; 1550 | 1551 | 1552 | pub const PY: CountryCode = CountryCode { 1553 | name: "Paraguay", 1554 | alpha2: "PY", 1555 | alpha3: "PRY", 1556 | numeric: 600, 1557 | }; 1558 | 1559 | 1560 | pub const PE: CountryCode = CountryCode { 1561 | name: "Peru", 1562 | alpha2: "PE", 1563 | alpha3: "PER", 1564 | numeric: 604, 1565 | }; 1566 | 1567 | 1568 | pub const PH: CountryCode = CountryCode { 1569 | name: "Philippines", 1570 | alpha2: "PH", 1571 | alpha3: "PHL", 1572 | numeric: 608, 1573 | }; 1574 | 1575 | 1576 | pub const PN: CountryCode = CountryCode { 1577 | name: "Pitcairn", 1578 | alpha2: "PN", 1579 | alpha3: "PCN", 1580 | numeric: 612, 1581 | }; 1582 | 1583 | 1584 | pub const PL: CountryCode = CountryCode { 1585 | name: "Poland", 1586 | alpha2: "PL", 1587 | alpha3: "POL", 1588 | numeric: 616, 1589 | }; 1590 | 1591 | 1592 | pub const PT: CountryCode = CountryCode { 1593 | name: "Portugal", 1594 | alpha2: "PT", 1595 | alpha3: "PRT", 1596 | numeric: 620, 1597 | }; 1598 | 1599 | 1600 | pub const PR: CountryCode = CountryCode { 1601 | name: "Puerto Rico", 1602 | alpha2: "PR", 1603 | alpha3: "PRI", 1604 | numeric: 630, 1605 | }; 1606 | 1607 | 1608 | pub const QA: CountryCode = CountryCode { 1609 | name: "Qatar", 1610 | alpha2: "QA", 1611 | alpha3: "QAT", 1612 | numeric: 634, 1613 | }; 1614 | 1615 | 1616 | pub const RE: CountryCode = CountryCode { 1617 | name: "Réunion", 1618 | alpha2: "RE", 1619 | alpha3: "REU", 1620 | numeric: 638, 1621 | }; 1622 | 1623 | 1624 | pub const RO: CountryCode = CountryCode { 1625 | name: "Romania", 1626 | alpha2: "RO", 1627 | alpha3: "ROU", 1628 | numeric: 642, 1629 | }; 1630 | 1631 | 1632 | pub const RU: CountryCode = CountryCode { 1633 | name: "Russian Federation", 1634 | alpha2: "RU", 1635 | alpha3: "RUS", 1636 | numeric: 643, 1637 | }; 1638 | 1639 | 1640 | pub const RW: CountryCode = CountryCode { 1641 | name: "Rwanda", 1642 | alpha2: "RW", 1643 | alpha3: "RWA", 1644 | numeric: 646, 1645 | }; 1646 | 1647 | 1648 | pub const BL: CountryCode = CountryCode { 1649 | name: "Saint Barthélemy", 1650 | alpha2: "BL", 1651 | alpha3: "BLM", 1652 | numeric: 652, 1653 | }; 1654 | 1655 | 1656 | pub const SH: CountryCode = CountryCode { 1657 | name: "Saint Helena, Ascension and Tristan da Cunha[d]", 1658 | alpha2: "SH", 1659 | alpha3: "SHN", 1660 | numeric: 654, 1661 | }; 1662 | 1663 | 1664 | pub const KN: CountryCode = CountryCode { 1665 | name: "Saint Kitts and Nevis", 1666 | alpha2: "KN", 1667 | alpha3: "KNA", 1668 | numeric: 659, 1669 | }; 1670 | 1671 | 1672 | pub const LC: CountryCode = CountryCode { 1673 | name: "Saint Lucia", 1674 | alpha2: "LC", 1675 | alpha3: "LCA", 1676 | numeric: 662, 1677 | }; 1678 | 1679 | 1680 | pub const MF: CountryCode = CountryCode { 1681 | name: "Saint Martin (French part)", 1682 | alpha2: "MF", 1683 | alpha3: "MAF", 1684 | numeric: 663, 1685 | }; 1686 | 1687 | 1688 | pub const PM: CountryCode = CountryCode { 1689 | name: "Saint Pierre and Miquelon", 1690 | alpha2: "PM", 1691 | alpha3: "SPM", 1692 | numeric: 666, 1693 | }; 1694 | 1695 | 1696 | pub const VC: CountryCode = CountryCode { 1697 | name: "Saint Vincent and the Grenadines", 1698 | alpha2: "VC", 1699 | alpha3: "VCT", 1700 | numeric: 670, 1701 | }; 1702 | 1703 | 1704 | pub const WS: CountryCode = CountryCode { 1705 | name: "Samoa", 1706 | alpha2: "WS", 1707 | alpha3: "WSM", 1708 | numeric: 882, 1709 | }; 1710 | 1711 | 1712 | pub const SM: CountryCode = CountryCode { 1713 | name: "San Marino", 1714 | alpha2: "SM", 1715 | alpha3: "SMR", 1716 | numeric: 674, 1717 | }; 1718 | 1719 | 1720 | pub const ST: CountryCode = CountryCode { 1721 | name: "Sao Tome and Principe", 1722 | alpha2: "ST", 1723 | alpha3: "STP", 1724 | numeric: 678, 1725 | }; 1726 | 1727 | 1728 | pub const SA: CountryCode = CountryCode { 1729 | name: "Saudi Arabia", 1730 | alpha2: "SA", 1731 | alpha3: "SAU", 1732 | numeric: 682, 1733 | }; 1734 | 1735 | 1736 | pub const SN: CountryCode = CountryCode { 1737 | name: "Senegal", 1738 | alpha2: "SN", 1739 | alpha3: "SEN", 1740 | numeric: 686, 1741 | }; 1742 | 1743 | 1744 | pub const RS: CountryCode = CountryCode { 1745 | name: "Serbia", 1746 | alpha2: "RS", 1747 | alpha3: "SRB", 1748 | numeric: 688, 1749 | }; 1750 | 1751 | 1752 | pub const SC: CountryCode = CountryCode { 1753 | name: "Seychelles", 1754 | alpha2: "SC", 1755 | alpha3: "SYC", 1756 | numeric: 690, 1757 | }; 1758 | 1759 | 1760 | pub const SL: CountryCode = CountryCode { 1761 | name: "Sierra Leone", 1762 | alpha2: "SL", 1763 | alpha3: "SLE", 1764 | numeric: 694, 1765 | }; 1766 | 1767 | 1768 | pub const SG: CountryCode = CountryCode { 1769 | name: "Singapore", 1770 | alpha2: "SG", 1771 | alpha3: "SGP", 1772 | numeric: 702, 1773 | }; 1774 | 1775 | 1776 | pub const SX: CountryCode = CountryCode { 1777 | name: "Sint Maarten (Dutch part)", 1778 | alpha2: "SX", 1779 | alpha3: "SXM", 1780 | numeric: 534, 1781 | }; 1782 | 1783 | 1784 | pub const SK: CountryCode = CountryCode { 1785 | name: "Slovakia", 1786 | alpha2: "SK", 1787 | alpha3: "SVK", 1788 | numeric: 703, 1789 | }; 1790 | 1791 | 1792 | pub const SI: CountryCode = CountryCode { 1793 | name: "Slovenia", 1794 | alpha2: "SI", 1795 | alpha3: "SVN", 1796 | numeric: 705, 1797 | }; 1798 | 1799 | 1800 | pub const SB: CountryCode = CountryCode { 1801 | name: "Solomon Islands", 1802 | alpha2: "SB", 1803 | alpha3: "SLB", 1804 | numeric: 90, 1805 | }; 1806 | 1807 | 1808 | pub const SO: CountryCode = CountryCode { 1809 | name: "Somalia", 1810 | alpha2: "SO", 1811 | alpha3: "SOM", 1812 | numeric: 706, 1813 | }; 1814 | 1815 | 1816 | pub const ZA: CountryCode = CountryCode { 1817 | name: "South Africa", 1818 | alpha2: "ZA", 1819 | alpha3: "ZAF", 1820 | numeric: 710, 1821 | }; 1822 | 1823 | 1824 | pub const GS: CountryCode = CountryCode { 1825 | name: "South Georgia and the South Sandwich Islands", 1826 | alpha2: "GS", 1827 | alpha3: "SGS", 1828 | numeric: 239, 1829 | }; 1830 | 1831 | 1832 | pub const SS: CountryCode = CountryCode { 1833 | name: "South Sudan", 1834 | alpha2: "SS", 1835 | alpha3: "SSD", 1836 | numeric: 728, 1837 | }; 1838 | 1839 | 1840 | pub const ES: CountryCode = CountryCode { 1841 | name: "Spain", 1842 | alpha2: "ES", 1843 | alpha3: "ESP", 1844 | numeric: 724, 1845 | }; 1846 | 1847 | 1848 | pub const LK: CountryCode = CountryCode { 1849 | name: "Sri Lanka", 1850 | alpha2: "LK", 1851 | alpha3: "LKA", 1852 | numeric: 144, 1853 | }; 1854 | 1855 | 1856 | pub const SD: CountryCode = CountryCode { 1857 | name: "Sudan", 1858 | alpha2: "SD", 1859 | alpha3: "SDN", 1860 | numeric: 729, 1861 | }; 1862 | 1863 | 1864 | pub const SR: CountryCode = CountryCode { 1865 | name: "Suriname", 1866 | alpha2: "SR", 1867 | alpha3: "SUR", 1868 | numeric: 740, 1869 | }; 1870 | 1871 | 1872 | pub const SJ: CountryCode = CountryCode { 1873 | name: "Svalbard and Jan Mayen[e]", 1874 | alpha2: "SJ", 1875 | alpha3: "SJM", 1876 | numeric: 744, 1877 | }; 1878 | 1879 | 1880 | pub const SE: CountryCode = CountryCode { 1881 | name: "Sweden", 1882 | alpha2: "SE", 1883 | alpha3: "SWE", 1884 | numeric: 752, 1885 | }; 1886 | 1887 | 1888 | pub const CH: CountryCode = CountryCode { 1889 | name: "Switzerland", 1890 | alpha2: "CH", 1891 | alpha3: "CHE", 1892 | numeric: 756, 1893 | }; 1894 | 1895 | 1896 | pub const SY: CountryCode = CountryCode { 1897 | name: "Syrian Arab Republic", 1898 | alpha2: "SY", 1899 | alpha3: "SYR", 1900 | numeric: 760, 1901 | }; 1902 | 1903 | 1904 | pub const TW: CountryCode = CountryCode { 1905 | name: "Taiwan, Province of China", 1906 | alpha2: "TW", 1907 | alpha3: "TWN", 1908 | numeric: 158, 1909 | }; 1910 | 1911 | 1912 | pub const TJ: CountryCode = CountryCode { 1913 | name: "Tajikistan", 1914 | alpha2: "TJ", 1915 | alpha3: "TJK", 1916 | numeric: 762, 1917 | }; 1918 | 1919 | 1920 | pub const TZ: CountryCode = CountryCode { 1921 | name: "Tanzania, United Republic of", 1922 | alpha2: "TZ", 1923 | alpha3: "TZA", 1924 | numeric: 834, 1925 | }; 1926 | 1927 | 1928 | pub const TH: CountryCode = CountryCode { 1929 | name: "Thailand", 1930 | alpha2: "TH", 1931 | alpha3: "THA", 1932 | numeric: 764, 1933 | }; 1934 | 1935 | 1936 | pub const TL: CountryCode = CountryCode { 1937 | name: "Timor-Leste", 1938 | alpha2: "TL", 1939 | alpha3: "TLS", 1940 | numeric: 626, 1941 | }; 1942 | 1943 | 1944 | pub const TG: CountryCode = CountryCode { 1945 | name: "Togo", 1946 | alpha2: "TG", 1947 | alpha3: "TGO", 1948 | numeric: 768, 1949 | }; 1950 | 1951 | 1952 | pub const TK: CountryCode = CountryCode { 1953 | name: "Tokelau", 1954 | alpha2: "TK", 1955 | alpha3: "TKL", 1956 | numeric: 772, 1957 | }; 1958 | 1959 | 1960 | pub const TO: CountryCode = CountryCode { 1961 | name: "Tonga", 1962 | alpha2: "TO", 1963 | alpha3: "TON", 1964 | numeric: 776, 1965 | }; 1966 | 1967 | 1968 | pub const TT: CountryCode = CountryCode { 1969 | name: "Trinidad and Tobago", 1970 | alpha2: "TT", 1971 | alpha3: "TTO", 1972 | numeric: 780, 1973 | }; 1974 | 1975 | 1976 | pub const TN: CountryCode = CountryCode { 1977 | name: "Tunisia", 1978 | alpha2: "TN", 1979 | alpha3: "TUN", 1980 | numeric: 788, 1981 | }; 1982 | 1983 | 1984 | pub const TR: CountryCode = CountryCode { 1985 | name: "Turkey", 1986 | alpha2: "TR", 1987 | alpha3: "TUR", 1988 | numeric: 792, 1989 | }; 1990 | 1991 | 1992 | pub const TM: CountryCode = CountryCode { 1993 | name: "Turkmenistan", 1994 | alpha2: "TM", 1995 | alpha3: "TKM", 1996 | numeric: 795, 1997 | }; 1998 | 1999 | 2000 | pub const TC: CountryCode = CountryCode { 2001 | name: "Turks and Caicos Islands", 2002 | alpha2: "TC", 2003 | alpha3: "TCA", 2004 | numeric: 796, 2005 | }; 2006 | 2007 | 2008 | pub const TV: CountryCode = CountryCode { 2009 | name: "Tuvalu", 2010 | alpha2: "TV", 2011 | alpha3: "TUV", 2012 | numeric: 798, 2013 | }; 2014 | 2015 | 2016 | pub const UG: CountryCode = CountryCode { 2017 | name: "Uganda", 2018 | alpha2: "UG", 2019 | alpha3: "UGA", 2020 | numeric: 800, 2021 | }; 2022 | 2023 | 2024 | pub const UA: CountryCode = CountryCode { 2025 | name: "Ukraine", 2026 | alpha2: "UA", 2027 | alpha3: "UKR", 2028 | numeric: 804, 2029 | }; 2030 | 2031 | 2032 | pub const AE: CountryCode = CountryCode { 2033 | name: "United Arab Emirates", 2034 | alpha2: "AE", 2035 | alpha3: "ARE", 2036 | numeric: 784, 2037 | }; 2038 | 2039 | 2040 | pub const GB: CountryCode = CountryCode { 2041 | name: "United Kingdom of Great Britain and Northern Ireland", 2042 | alpha2: "GB", 2043 | alpha3: "GBR", 2044 | numeric: 826, 2045 | }; 2046 | 2047 | 2048 | pub const US: CountryCode = CountryCode { 2049 | name: "United States of America", 2050 | alpha2: "US", 2051 | alpha3: "USA", 2052 | numeric: 840, 2053 | }; 2054 | 2055 | 2056 | pub const UM: CountryCode = CountryCode { 2057 | name: "United States Minor Outlying Islands[f]", 2058 | alpha2: "UM", 2059 | alpha3: "UMI", 2060 | numeric: 581, 2061 | }; 2062 | 2063 | 2064 | pub const UY: CountryCode = CountryCode { 2065 | name: "Uruguay", 2066 | alpha2: "UY", 2067 | alpha3: "URY", 2068 | numeric: 858, 2069 | }; 2070 | 2071 | 2072 | pub const UZ: CountryCode = CountryCode { 2073 | name: "Uzbekistan", 2074 | alpha2: "UZ", 2075 | alpha3: "UZB", 2076 | numeric: 860, 2077 | }; 2078 | 2079 | 2080 | pub const VU: CountryCode = CountryCode { 2081 | name: "Vanuatu", 2082 | alpha2: "VU", 2083 | alpha3: "VUT", 2084 | numeric: 548, 2085 | }; 2086 | 2087 | 2088 | pub const VE: CountryCode = CountryCode { 2089 | name: "Venezuela (Bolivarian Republic of)", 2090 | alpha2: "VE", 2091 | alpha3: "VEN", 2092 | numeric: 862, 2093 | }; 2094 | 2095 | 2096 | pub const VN: CountryCode = CountryCode { 2097 | name: "Viet Nam", 2098 | alpha2: "VN", 2099 | alpha3: "VNM", 2100 | numeric: 704, 2101 | }; 2102 | 2103 | 2104 | pub const VG: CountryCode = CountryCode { 2105 | name: "Virgin Islands (British)", 2106 | alpha2: "VG", 2107 | alpha3: "VGB", 2108 | numeric: 92, 2109 | }; 2110 | 2111 | 2112 | pub const VI: CountryCode = CountryCode { 2113 | name: "Virgin Islands (U.S.)", 2114 | alpha2: "VI", 2115 | alpha3: "VIR", 2116 | numeric: 850, 2117 | }; 2118 | 2119 | 2120 | pub const WF: CountryCode = CountryCode { 2121 | name: "Wallis and Futuna", 2122 | alpha2: "WF", 2123 | alpha3: "WLF", 2124 | numeric: 876, 2125 | }; 2126 | 2127 | 2128 | pub const EH: CountryCode = CountryCode { 2129 | name: "Western Sahara", 2130 | alpha2: "EH", 2131 | alpha3: "ESH", 2132 | numeric: 732, 2133 | }; 2134 | 2135 | 2136 | pub const YE: CountryCode = CountryCode { 2137 | name: "Yemen", 2138 | alpha2: "YE", 2139 | alpha3: "YEM", 2140 | numeric: 887, 2141 | }; 2142 | 2143 | 2144 | pub const ZM: CountryCode = CountryCode { 2145 | name: "Zambia", 2146 | alpha2: "ZM", 2147 | alpha3: "ZMB", 2148 | numeric: 894, 2149 | }; 2150 | 2151 | 2152 | pub const ZW: CountryCode = CountryCode { 2153 | name: "Zimbabwe", 2154 | alpha2: "ZW", 2155 | alpha3: "ZWE", 2156 | numeric: 716, 2157 | }; 2158 | 2159 | 2160 | 2161 | ///CountryCode map with alpha2 Code key 2162 | pub const ALPHA2_MAP: Map<&str, CountryCode> = phf_map! { 2163 | 2164 | 2165 | "AF" => AF, 2166 | "AX" => AX, 2167 | "AL" => AL, 2168 | "DZ" => DZ, 2169 | "AS" => AS, 2170 | "AD" => AD, 2171 | "AO" => AO, 2172 | "AI" => AI, 2173 | "AQ" => AQ, 2174 | "AG" => AG, 2175 | "AR" => AR, 2176 | "AM" => AM, 2177 | "AW" => AW, 2178 | "AU" => AU, 2179 | "AT" => AT, 2180 | "AZ" => AZ, 2181 | "BS" => BS, 2182 | "BH" => BH, 2183 | "BD" => BD, 2184 | "BB" => BB, 2185 | "BY" => BY, 2186 | "BE" => BE, 2187 | "BZ" => BZ, 2188 | "BJ" => BJ, 2189 | "BM" => BM, 2190 | "BT" => BT, 2191 | "BO" => BO, 2192 | "BQ" => BQ, 2193 | "BA" => BA, 2194 | "BW" => BW, 2195 | "BV" => BV, 2196 | "BR" => BR, 2197 | "IO" => IO, 2198 | "BN" => BN, 2199 | "BG" => BG, 2200 | "BF" => BF, 2201 | "BI" => BI, 2202 | "CV" => CV, 2203 | "KH" => KH, 2204 | "CM" => CM, 2205 | "CA" => CA, 2206 | "KY" => KY, 2207 | "CF" => CF, 2208 | "TD" => TD, 2209 | "CL" => CL, 2210 | "CN" => CN, 2211 | "CX" => CX, 2212 | "CC" => CC, 2213 | "CO" => CO, 2214 | "KM" => KM, 2215 | "CG" => CG, 2216 | "CD" => CD, 2217 | "CK" => CK, 2218 | "CR" => CR, 2219 | "CI" => CI, 2220 | "HR" => HR, 2221 | "CU" => CU, 2222 | "CW" => CW, 2223 | "CY" => CY, 2224 | "CZ" => CZ, 2225 | "DK" => DK, 2226 | "DJ" => DJ, 2227 | "DM" => DM, 2228 | "DO" => DO, 2229 | "EC" => EC, 2230 | "EG" => EG, 2231 | "SV" => SV, 2232 | "GQ" => GQ, 2233 | "ER" => ER, 2234 | "EE" => EE, 2235 | "SZ" => SZ, 2236 | "ET" => ET, 2237 | "FK" => FK, 2238 | "FO" => FO, 2239 | "FJ" => FJ, 2240 | "FI" => FI, 2241 | "FR" => FR, 2242 | "GF" => GF, 2243 | "PF" => PF, 2244 | "TF" => TF, 2245 | "GA" => GA, 2246 | "GM" => GM, 2247 | "GE" => GE, 2248 | "DE" => DE, 2249 | "GH" => GH, 2250 | "GI" => GI, 2251 | "GR" => GR, 2252 | "GL" => GL, 2253 | "GD" => GD, 2254 | "GP" => GP, 2255 | "GU" => GU, 2256 | "GT" => GT, 2257 | "GG" => GG, 2258 | "GN" => GN, 2259 | "GW" => GW, 2260 | "GY" => GY, 2261 | "HT" => HT, 2262 | "HM" => HM, 2263 | "VA" => VA, 2264 | "HN" => HN, 2265 | "HK" => HK, 2266 | "HU" => HU, 2267 | "IS" => IS, 2268 | "IN" => IN, 2269 | "ID" => ID, 2270 | "IR" => IR, 2271 | "IQ" => IQ, 2272 | "IE" => IE, 2273 | "IM" => IM, 2274 | "IL" => IL, 2275 | "IT" => IT, 2276 | "JM" => JM, 2277 | "JP" => JP, 2278 | "JE" => JE, 2279 | "JO" => JO, 2280 | "KZ" => KZ, 2281 | "KE" => KE, 2282 | "KI" => KI, 2283 | "KP" => KP, 2284 | "KR" => KR, 2285 | "KW" => KW, 2286 | "KG" => KG, 2287 | "LA" => LA, 2288 | "LV" => LV, 2289 | "LB" => LB, 2290 | "LS" => LS, 2291 | "LR" => LR, 2292 | "LY" => LY, 2293 | "LI" => LI, 2294 | "LT" => LT, 2295 | "LU" => LU, 2296 | "MO" => MO, 2297 | "MG" => MG, 2298 | "MW" => MW, 2299 | "MY" => MY, 2300 | "MV" => MV, 2301 | "ML" => ML, 2302 | "MT" => MT, 2303 | "MH" => MH, 2304 | "MQ" => MQ, 2305 | "MR" => MR, 2306 | "MU" => MU, 2307 | "YT" => YT, 2308 | "MX" => MX, 2309 | "FM" => FM, 2310 | "MD" => MD, 2311 | "MC" => MC, 2312 | "MN" => MN, 2313 | "ME" => ME, 2314 | "MS" => MS, 2315 | "MA" => MA, 2316 | "MZ" => MZ, 2317 | "MM" => MM, 2318 | "NA" => NA, 2319 | "NR" => NR, 2320 | "NP" => NP, 2321 | "NL" => NL, 2322 | "NC" => NC, 2323 | "NZ" => NZ, 2324 | "NI" => NI, 2325 | "NE" => NE, 2326 | "NG" => NG, 2327 | "NU" => NU, 2328 | "NF" => NF, 2329 | "MK" => MK, 2330 | "MP" => MP, 2331 | "NO" => NO, 2332 | "OM" => OM, 2333 | "PK" => PK, 2334 | "PW" => PW, 2335 | "PS" => PS, 2336 | "PA" => PA, 2337 | "PG" => PG, 2338 | "PY" => PY, 2339 | "PE" => PE, 2340 | "PH" => PH, 2341 | "PN" => PN, 2342 | "PL" => PL, 2343 | "PT" => PT, 2344 | "PR" => PR, 2345 | "QA" => QA, 2346 | "RE" => RE, 2347 | "RO" => RO, 2348 | "RU" => RU, 2349 | "RW" => RW, 2350 | "BL" => BL, 2351 | "SH" => SH, 2352 | "KN" => KN, 2353 | "LC" => LC, 2354 | "MF" => MF, 2355 | "PM" => PM, 2356 | "VC" => VC, 2357 | "WS" => WS, 2358 | "SM" => SM, 2359 | "ST" => ST, 2360 | "SA" => SA, 2361 | "SN" => SN, 2362 | "RS" => RS, 2363 | "SC" => SC, 2364 | "SL" => SL, 2365 | "SG" => SG, 2366 | "SX" => SX, 2367 | "SK" => SK, 2368 | "SI" => SI, 2369 | "SB" => SB, 2370 | "SO" => SO, 2371 | "ZA" => ZA, 2372 | "GS" => GS, 2373 | "SS" => SS, 2374 | "ES" => ES, 2375 | "LK" => LK, 2376 | "SD" => SD, 2377 | "SR" => SR, 2378 | "SJ" => SJ, 2379 | "SE" => SE, 2380 | "CH" => CH, 2381 | "SY" => SY, 2382 | "TW" => TW, 2383 | "TJ" => TJ, 2384 | "TZ" => TZ, 2385 | "TH" => TH, 2386 | "TL" => TL, 2387 | "TG" => TG, 2388 | "TK" => TK, 2389 | "TO" => TO, 2390 | "TT" => TT, 2391 | "TN" => TN, 2392 | "TR" => TR, 2393 | "TM" => TM, 2394 | "TC" => TC, 2395 | "TV" => TV, 2396 | "UG" => UG, 2397 | "UA" => UA, 2398 | "AE" => AE, 2399 | "GB" => GB, 2400 | "US" => US, 2401 | "UM" => UM, 2402 | "UY" => UY, 2403 | "UZ" => UZ, 2404 | "VU" => VU, 2405 | "VE" => VE, 2406 | "VN" => VN, 2407 | "VG" => VG, 2408 | "VI" => VI, 2409 | "WF" => WF, 2410 | "EH" => EH, 2411 | "YE" => YE, 2412 | "ZM" => ZM, 2413 | "ZW" => ZW, 2414 | 2415 | 2416 | }; 2417 | 2418 | 2419 | ///CountryCode map with alpha3 Code key 2420 | pub const ALPHA3_MAP: Map<&str, CountryCode> = phf_map! { 2421 | 2422 | 2423 | "AFG" => AF, 2424 | "ALA" => AX, 2425 | "ALB" => AL, 2426 | "DZA" => DZ, 2427 | "ASM" => AS, 2428 | "AND" => AD, 2429 | "AGO" => AO, 2430 | "AIA" => AI, 2431 | "ATA" => AQ, 2432 | "ATG" => AG, 2433 | "ARG" => AR, 2434 | "ARM" => AM, 2435 | "ABW" => AW, 2436 | "AUS" => AU, 2437 | "AUT" => AT, 2438 | "AZE" => AZ, 2439 | "BHS" => BS, 2440 | "BHR" => BH, 2441 | "BGD" => BD, 2442 | "BRB" => BB, 2443 | "BLR" => BY, 2444 | "BEL" => BE, 2445 | "BLZ" => BZ, 2446 | "BEN" => BJ, 2447 | "BMU" => BM, 2448 | "BTN" => BT, 2449 | "BOL" => BO, 2450 | "BES" => BQ, 2451 | "BIH" => BA, 2452 | "BWA" => BW, 2453 | "BVT" => BV, 2454 | "BRA" => BR, 2455 | "IOT" => IO, 2456 | "BRN" => BN, 2457 | "BGR" => BG, 2458 | "BFA" => BF, 2459 | "BDI" => BI, 2460 | "CPV" => CV, 2461 | "KHM" => KH, 2462 | "CMR" => CM, 2463 | "CAN" => CA, 2464 | "CYM" => KY, 2465 | "CAF" => CF, 2466 | "TCD" => TD, 2467 | "CHL" => CL, 2468 | "CHN" => CN, 2469 | "CXR" => CX, 2470 | "CCK" => CC, 2471 | "COL" => CO, 2472 | "COM" => KM, 2473 | "COG" => CG, 2474 | "COD" => CD, 2475 | "COK" => CK, 2476 | "CRI" => CR, 2477 | "CIV" => CI, 2478 | "HRV" => HR, 2479 | "CUB" => CU, 2480 | "CUW" => CW, 2481 | "CYP" => CY, 2482 | "CZE" => CZ, 2483 | "DNK" => DK, 2484 | "DJI" => DJ, 2485 | "DMA" => DM, 2486 | "DOM" => DO, 2487 | "ECU" => EC, 2488 | "EGY" => EG, 2489 | "SLV" => SV, 2490 | "GNQ" => GQ, 2491 | "ERI" => ER, 2492 | "EST" => EE, 2493 | "SWZ" => SZ, 2494 | "ETH" => ET, 2495 | "FLK" => FK, 2496 | "FRO" => FO, 2497 | "FJI" => FJ, 2498 | "FIN" => FI, 2499 | "FRA" => FR, 2500 | "GUF" => GF, 2501 | "PYF" => PF, 2502 | "ATF" => TF, 2503 | "GAB" => GA, 2504 | "GMB" => GM, 2505 | "GEO" => GE, 2506 | "DEU" => DE, 2507 | "GHA" => GH, 2508 | "GIB" => GI, 2509 | "GRC" => GR, 2510 | "GRL" => GL, 2511 | "GRD" => GD, 2512 | "GLP" => GP, 2513 | "GUM" => GU, 2514 | "GTM" => GT, 2515 | "GGY" => GG, 2516 | "GIN" => GN, 2517 | "GNB" => GW, 2518 | "GUY" => GY, 2519 | "HTI" => HT, 2520 | "HMD" => HM, 2521 | "VAT" => VA, 2522 | "HND" => HN, 2523 | "HKG" => HK, 2524 | "HUN" => HU, 2525 | "ISL" => IS, 2526 | "IND" => IN, 2527 | "IDN" => ID, 2528 | "IRN" => IR, 2529 | "IRQ" => IQ, 2530 | "IRL" => IE, 2531 | "IMN" => IM, 2532 | "ISR" => IL, 2533 | "ITA" => IT, 2534 | "JAM" => JM, 2535 | "JPN" => JP, 2536 | "JEY" => JE, 2537 | "JOR" => JO, 2538 | "KAZ" => KZ, 2539 | "KEN" => KE, 2540 | "KIR" => KI, 2541 | "PRK" => KP, 2542 | "KOR" => KR, 2543 | "KWT" => KW, 2544 | "KGZ" => KG, 2545 | "LAO" => LA, 2546 | "LVA" => LV, 2547 | "LBN" => LB, 2548 | "LSO" => LS, 2549 | "LBR" => LR, 2550 | "LBY" => LY, 2551 | "LIE" => LI, 2552 | "LTU" => LT, 2553 | "LUX" => LU, 2554 | "MAC" => MO, 2555 | "MDG" => MG, 2556 | "MWI" => MW, 2557 | "MYS" => MY, 2558 | "MDV" => MV, 2559 | "MLI" => ML, 2560 | "MLT" => MT, 2561 | "MHL" => MH, 2562 | "MTQ" => MQ, 2563 | "MRT" => MR, 2564 | "MUS" => MU, 2565 | "MYT" => YT, 2566 | "MEX" => MX, 2567 | "FSM" => FM, 2568 | "MDA" => MD, 2569 | "MCO" => MC, 2570 | "MNG" => MN, 2571 | "MNE" => ME, 2572 | "MSR" => MS, 2573 | "MAR" => MA, 2574 | "MOZ" => MZ, 2575 | "MMR" => MM, 2576 | "NAM" => NA, 2577 | "NRU" => NR, 2578 | "NPL" => NP, 2579 | "NLD" => NL, 2580 | "NCL" => NC, 2581 | "NZL" => NZ, 2582 | "NIC" => NI, 2583 | "NER" => NE, 2584 | "NGA" => NG, 2585 | "NIU" => NU, 2586 | "NFK" => NF, 2587 | "MKD" => MK, 2588 | "MNP" => MP, 2589 | "NOR" => NO, 2590 | "OMN" => OM, 2591 | "PAK" => PK, 2592 | "PLW" => PW, 2593 | "PSE" => PS, 2594 | "PAN" => PA, 2595 | "PNG" => PG, 2596 | "PRY" => PY, 2597 | "PER" => PE, 2598 | "PHL" => PH, 2599 | "PCN" => PN, 2600 | "POL" => PL, 2601 | "PRT" => PT, 2602 | "PRI" => PR, 2603 | "QAT" => QA, 2604 | "REU" => RE, 2605 | "ROU" => RO, 2606 | "RUS" => RU, 2607 | "RWA" => RW, 2608 | "BLM" => BL, 2609 | "SHN" => SH, 2610 | "KNA" => KN, 2611 | "LCA" => LC, 2612 | "MAF" => MF, 2613 | "SPM" => PM, 2614 | "VCT" => VC, 2615 | "WSM" => WS, 2616 | "SMR" => SM, 2617 | "STP" => ST, 2618 | "SAU" => SA, 2619 | "SEN" => SN, 2620 | "SRB" => RS, 2621 | "SYC" => SC, 2622 | "SLE" => SL, 2623 | "SGP" => SG, 2624 | "SXM" => SX, 2625 | "SVK" => SK, 2626 | "SVN" => SI, 2627 | "SLB" => SB, 2628 | "SOM" => SO, 2629 | "ZAF" => ZA, 2630 | "SGS" => GS, 2631 | "SSD" => SS, 2632 | "ESP" => ES, 2633 | "LKA" => LK, 2634 | "SDN" => SD, 2635 | "SUR" => SR, 2636 | "SJM" => SJ, 2637 | "SWE" => SE, 2638 | "CHE" => CH, 2639 | "SYR" => SY, 2640 | "TWN" => TW, 2641 | "TJK" => TJ, 2642 | "TZA" => TZ, 2643 | "THA" => TH, 2644 | "TLS" => TL, 2645 | "TGO" => TG, 2646 | "TKL" => TK, 2647 | "TON" => TO, 2648 | "TTO" => TT, 2649 | "TUN" => TN, 2650 | "TUR" => TR, 2651 | "TKM" => TM, 2652 | "TCA" => TC, 2653 | "TUV" => TV, 2654 | "UGA" => UG, 2655 | "UKR" => UA, 2656 | "ARE" => AE, 2657 | "GBR" => GB, 2658 | "USA" => US, 2659 | "UMI" => UM, 2660 | "URY" => UY, 2661 | "UZB" => UZ, 2662 | "VUT" => VU, 2663 | "VEN" => VE, 2664 | "VNM" => VN, 2665 | "VGB" => VG, 2666 | "VIR" => VI, 2667 | "WLF" => WF, 2668 | "ESH" => EH, 2669 | "YEM" => YE, 2670 | "ZMB" => ZM, 2671 | "ZWE" => ZW, 2672 | 2673 | 2674 | }; 2675 | 2676 | 2677 | ///CountryCode map with 3 len numeric str Code key 2678 | pub const NUMERIC_MAP: Map<&str, CountryCode> = phf_map! { 2679 | 2680 | 2681 | "004" => AF, 2682 | "248" => AX, 2683 | "008" => AL, 2684 | "012" => DZ, 2685 | "016" => AS, 2686 | "020" => AD, 2687 | "024" => AO, 2688 | "660" => AI, 2689 | "010" => AQ, 2690 | "028" => AG, 2691 | "032" => AR, 2692 | "051" => AM, 2693 | "533" => AW, 2694 | "036" => AU, 2695 | "040" => AT, 2696 | "031" => AZ, 2697 | "044" => BS, 2698 | "048" => BH, 2699 | "050" => BD, 2700 | "052" => BB, 2701 | "112" => BY, 2702 | "056" => BE, 2703 | "084" => BZ, 2704 | "204" => BJ, 2705 | "060" => BM, 2706 | "064" => BT, 2707 | "068" => BO, 2708 | "535" => BQ, 2709 | "070" => BA, 2710 | "072" => BW, 2711 | "074" => BV, 2712 | "076" => BR, 2713 | "086" => IO, 2714 | "096" => BN, 2715 | "100" => BG, 2716 | "854" => BF, 2717 | "108" => BI, 2718 | "132" => CV, 2719 | "116" => KH, 2720 | "120" => CM, 2721 | "124" => CA, 2722 | "136" => KY, 2723 | "140" => CF, 2724 | "148" => TD, 2725 | "152" => CL, 2726 | "156" => CN, 2727 | "162" => CX, 2728 | "166" => CC, 2729 | "170" => CO, 2730 | "174" => KM, 2731 | "178" => CG, 2732 | "180" => CD, 2733 | "184" => CK, 2734 | "188" => CR, 2735 | "384" => CI, 2736 | "191" => HR, 2737 | "192" => CU, 2738 | "531" => CW, 2739 | "196" => CY, 2740 | "203" => CZ, 2741 | "208" => DK, 2742 | "262" => DJ, 2743 | "212" => DM, 2744 | "214" => DO, 2745 | "218" => EC, 2746 | "818" => EG, 2747 | "222" => SV, 2748 | "226" => GQ, 2749 | "232" => ER, 2750 | "233" => EE, 2751 | "748" => SZ, 2752 | "231" => ET, 2753 | "238" => FK, 2754 | "234" => FO, 2755 | "242" => FJ, 2756 | "246" => FI, 2757 | "250" => FR, 2758 | "254" => GF, 2759 | "258" => PF, 2760 | "260" => TF, 2761 | "266" => GA, 2762 | "270" => GM, 2763 | "268" => GE, 2764 | "276" => DE, 2765 | "288" => GH, 2766 | "292" => GI, 2767 | "300" => GR, 2768 | "304" => GL, 2769 | "308" => GD, 2770 | "312" => GP, 2771 | "316" => GU, 2772 | "320" => GT, 2773 | "831" => GG, 2774 | "324" => GN, 2775 | "624" => GW, 2776 | "328" => GY, 2777 | "332" => HT, 2778 | "334" => HM, 2779 | "336" => VA, 2780 | "340" => HN, 2781 | "344" => HK, 2782 | "348" => HU, 2783 | "352" => IS, 2784 | "356" => IN, 2785 | "360" => ID, 2786 | "364" => IR, 2787 | "368" => IQ, 2788 | "372" => IE, 2789 | "833" => IM, 2790 | "376" => IL, 2791 | "380" => IT, 2792 | "388" => JM, 2793 | "392" => JP, 2794 | "832" => JE, 2795 | "400" => JO, 2796 | "398" => KZ, 2797 | "404" => KE, 2798 | "296" => KI, 2799 | "408" => KP, 2800 | "410" => KR, 2801 | "414" => KW, 2802 | "417" => KG, 2803 | "418" => LA, 2804 | "428" => LV, 2805 | "422" => LB, 2806 | "426" => LS, 2807 | "430" => LR, 2808 | "434" => LY, 2809 | "438" => LI, 2810 | "440" => LT, 2811 | "442" => LU, 2812 | "446" => MO, 2813 | "450" => MG, 2814 | "454" => MW, 2815 | "458" => MY, 2816 | "462" => MV, 2817 | "466" => ML, 2818 | "470" => MT, 2819 | "584" => MH, 2820 | "474" => MQ, 2821 | "478" => MR, 2822 | "480" => MU, 2823 | "175" => YT, 2824 | "484" => MX, 2825 | "583" => FM, 2826 | "498" => MD, 2827 | "492" => MC, 2828 | "496" => MN, 2829 | "499" => ME, 2830 | "500" => MS, 2831 | "504" => MA, 2832 | "508" => MZ, 2833 | "104" => MM, 2834 | "516" => NA, 2835 | "520" => NR, 2836 | "524" => NP, 2837 | "528" => NL, 2838 | "540" => NC, 2839 | "554" => NZ, 2840 | "558" => NI, 2841 | "562" => NE, 2842 | "566" => NG, 2843 | "570" => NU, 2844 | "574" => NF, 2845 | "807" => MK, 2846 | "580" => MP, 2847 | "578" => NO, 2848 | "512" => OM, 2849 | "586" => PK, 2850 | "585" => PW, 2851 | "275" => PS, 2852 | "591" => PA, 2853 | "598" => PG, 2854 | "600" => PY, 2855 | "604" => PE, 2856 | "608" => PH, 2857 | "612" => PN, 2858 | "616" => PL, 2859 | "620" => PT, 2860 | "630" => PR, 2861 | "634" => QA, 2862 | "638" => RE, 2863 | "642" => RO, 2864 | "643" => RU, 2865 | "646" => RW, 2866 | "652" => BL, 2867 | "654" => SH, 2868 | "659" => KN, 2869 | "662" => LC, 2870 | "663" => MF, 2871 | "666" => PM, 2872 | "670" => VC, 2873 | "882" => WS, 2874 | "674" => SM, 2875 | "678" => ST, 2876 | "682" => SA, 2877 | "686" => SN, 2878 | "688" => RS, 2879 | "690" => SC, 2880 | "694" => SL, 2881 | "702" => SG, 2882 | "534" => SX, 2883 | "703" => SK, 2884 | "705" => SI, 2885 | "090" => SB, 2886 | "706" => SO, 2887 | "710" => ZA, 2888 | "239" => GS, 2889 | "728" => SS, 2890 | "724" => ES, 2891 | "144" => LK, 2892 | "729" => SD, 2893 | "740" => SR, 2894 | "744" => SJ, 2895 | "752" => SE, 2896 | "756" => CH, 2897 | "760" => SY, 2898 | "158" => TW, 2899 | "762" => TJ, 2900 | "834" => TZ, 2901 | "764" => TH, 2902 | "626" => TL, 2903 | "768" => TG, 2904 | "772" => TK, 2905 | "776" => TO, 2906 | "780" => TT, 2907 | "788" => TN, 2908 | "792" => TR, 2909 | "795" => TM, 2910 | "796" => TC, 2911 | "798" => TV, 2912 | "800" => UG, 2913 | "804" => UA, 2914 | "784" => AE, 2915 | "826" => GB, 2916 | "840" => US, 2917 | "581" => UM, 2918 | "858" => UY, 2919 | "860" => UZ, 2920 | "548" => VU, 2921 | "862" => VE, 2922 | "704" => VN, 2923 | "092" => VG, 2924 | "850" => VI, 2925 | "876" => WF, 2926 | "732" => EH, 2927 | "887" => YE, 2928 | "894" => ZM, 2929 | "716" => ZW, 2930 | 2931 | 2932 | }; 2933 | 2934 | 2935 | ///ALL the names of Countrys 2936 | pub const ALL_NAME: & [&str] = &[ 2937 | 2938 | 2939 | "Afghanistan", 2940 | "Åland Islands", 2941 | "Albania", 2942 | "Algeria", 2943 | "American Samoa", 2944 | "Andorra", 2945 | "Angola", 2946 | "Anguilla", 2947 | "Antarctica", 2948 | "Antigua and Barbuda", 2949 | "Argentina", 2950 | "Armenia", 2951 | "Aruba", 2952 | "Australia", 2953 | "Austria", 2954 | "Azerbaijan", 2955 | "Bahamas", 2956 | "Bahrain", 2957 | "Bangladesh", 2958 | "Barbados", 2959 | "Belarus", 2960 | "Belgium", 2961 | "Belize", 2962 | "Benin", 2963 | "Bermuda", 2964 | "Bhutan", 2965 | "Bolivia (Plurinational State of)", 2966 | "Bonaire, Sint Eustatius and Saba[c]", 2967 | "Bosnia and Herzegovina", 2968 | "Botswana", 2969 | "Bouvet Island", 2970 | "Brazil", 2971 | "British Indian Ocean Territory", 2972 | "Brunei Darussalam", 2973 | "Bulgaria", 2974 | "Burkina Faso", 2975 | "Burundi", 2976 | "Cabo Verde", 2977 | "Cambodia", 2978 | "Cameroon", 2979 | "Canada", 2980 | "Cayman Islands", 2981 | "Central African Republic", 2982 | "Chad", 2983 | "Chile", 2984 | "China", 2985 | "Christmas Island", 2986 | "Cocos (Keeling) Islands", 2987 | "Colombia", 2988 | "Comoros", 2989 | "Congo", 2990 | "Congo, Democratic Republic of the", 2991 | "Cook Islands", 2992 | "Costa Rica", 2993 | "Côte d'Ivoire", 2994 | "Croatia", 2995 | "Cuba", 2996 | "Curaçao", 2997 | "Cyprus", 2998 | "Czechia", 2999 | "Denmark", 3000 | "Djibouti", 3001 | "Dominica", 3002 | "Dominican Republic", 3003 | "Ecuador", 3004 | "Egypt", 3005 | "El Salvador", 3006 | "Equatorial Guinea", 3007 | "Eritrea", 3008 | "Estonia", 3009 | "Eswatini", 3010 | "Ethiopia", 3011 | "Falkland Islands (Malvinas)", 3012 | "Faroe Islands", 3013 | "Fiji", 3014 | "Finland", 3015 | "France", 3016 | "French Guiana", 3017 | "French Polynesia", 3018 | "French Southern Territories", 3019 | "Gabon", 3020 | "Gambia", 3021 | "Georgia", 3022 | "Germany", 3023 | "Ghana", 3024 | "Gibraltar", 3025 | "Greece", 3026 | "Greenland", 3027 | "Grenada", 3028 | "Guadeloupe", 3029 | "Guam", 3030 | "Guatemala", 3031 | "Guernsey", 3032 | "Guinea", 3033 | "Guinea-Bissau", 3034 | "Guyana", 3035 | "Haiti", 3036 | "Heard Island and McDonald Islands", 3037 | "Holy See", 3038 | "Honduras", 3039 | "Hong Kong", 3040 | "Hungary", 3041 | "Iceland", 3042 | "India", 3043 | "Indonesia", 3044 | "Iran (Islamic Republic of)", 3045 | "Iraq", 3046 | "Ireland", 3047 | "Isle of Man", 3048 | "Israel", 3049 | "Italy", 3050 | "Jamaica", 3051 | "Japan", 3052 | "Jersey", 3053 | "Jordan", 3054 | "Kazakhstan", 3055 | "Kenya", 3056 | "Kiribati", 3057 | "Korea (Democratic People's Republic of)", 3058 | "Korea, Republic of", 3059 | "Kuwait", 3060 | "Kyrgyzstan", 3061 | "Lao People's Democratic Republic", 3062 | "Latvia", 3063 | "Lebanon", 3064 | "Lesotho", 3065 | "Liberia", 3066 | "Libya", 3067 | "Liechtenstein", 3068 | "Lithuania", 3069 | "Luxembourg", 3070 | "Macao", 3071 | "Madagascar", 3072 | "Malawi", 3073 | "Malaysia", 3074 | "Maldives", 3075 | "Mali", 3076 | "Malta", 3077 | "Marshall Islands", 3078 | "Martinique", 3079 | "Mauritania", 3080 | "Mauritius", 3081 | "Mayotte", 3082 | "Mexico", 3083 | "Micronesia (Federated States of)", 3084 | "Moldova, Republic of", 3085 | "Monaco", 3086 | "Mongolia", 3087 | "Montenegro", 3088 | "Montserrat", 3089 | "Morocco", 3090 | "Mozambique", 3091 | "Myanmar", 3092 | "Namibia", 3093 | "Nauru", 3094 | "Nepal", 3095 | "Netherlands", 3096 | "New Caledonia", 3097 | "New Zealand", 3098 | "Nicaragua", 3099 | "Niger", 3100 | "Nigeria", 3101 | "Niue", 3102 | "Norfolk Island", 3103 | "North Macedonia", 3104 | "Northern Mariana Islands", 3105 | "Norway", 3106 | "Oman", 3107 | "Pakistan", 3108 | "Palau", 3109 | "Palestine, State of", 3110 | "Panama", 3111 | "Papua New Guinea", 3112 | "Paraguay", 3113 | "Peru", 3114 | "Philippines", 3115 | "Pitcairn", 3116 | "Poland", 3117 | "Portugal", 3118 | "Puerto Rico", 3119 | "Qatar", 3120 | "Réunion", 3121 | "Romania", 3122 | "Russian Federation", 3123 | "Rwanda", 3124 | "Saint Barthélemy", 3125 | "Saint Helena, Ascension and Tristan da Cunha[d]", 3126 | "Saint Kitts and Nevis", 3127 | "Saint Lucia", 3128 | "Saint Martin (French part)", 3129 | "Saint Pierre and Miquelon", 3130 | "Saint Vincent and the Grenadines", 3131 | "Samoa", 3132 | "San Marino", 3133 | "Sao Tome and Principe", 3134 | "Saudi Arabia", 3135 | "Senegal", 3136 | "Serbia", 3137 | "Seychelles", 3138 | "Sierra Leone", 3139 | "Singapore", 3140 | "Sint Maarten (Dutch part)", 3141 | "Slovakia", 3142 | "Slovenia", 3143 | "Solomon Islands", 3144 | "Somalia", 3145 | "South Africa", 3146 | "South Georgia and the South Sandwich Islands", 3147 | "South Sudan", 3148 | "Spain", 3149 | "Sri Lanka", 3150 | "Sudan", 3151 | "Suriname", 3152 | "Svalbard and Jan Mayen[e]", 3153 | "Sweden", 3154 | "Switzerland", 3155 | "Syrian Arab Republic", 3156 | "Taiwan, Province of China", 3157 | "Tajikistan", 3158 | "Tanzania, United Republic of", 3159 | "Thailand", 3160 | "Timor-Leste", 3161 | "Togo", 3162 | "Tokelau", 3163 | "Tonga", 3164 | "Trinidad and Tobago", 3165 | "Tunisia", 3166 | "Turkey", 3167 | "Turkmenistan", 3168 | "Turks and Caicos Islands", 3169 | "Tuvalu", 3170 | "Uganda", 3171 | "Ukraine", 3172 | "United Arab Emirates", 3173 | "United Kingdom of Great Britain and Northern Ireland", 3174 | "United States of America", 3175 | "United States Minor Outlying Islands[f]", 3176 | "Uruguay", 3177 | "Uzbekistan", 3178 | "Vanuatu", 3179 | "Venezuela (Bolivarian Republic of)", 3180 | "Viet Nam", 3181 | "Virgin Islands (British)", 3182 | "Virgin Islands (U.S.)", 3183 | "Wallis and Futuna", 3184 | "Western Sahara", 3185 | "Yemen", 3186 | "Zambia", 3187 | "Zimbabwe", 3188 | 3189 | 3190 | ]; 3191 | 3192 | 3193 | ///ALL the alpha2 codes of Countrys 3194 | pub const ALL_ALPHA2: & [&str] = &[ 3195 | 3196 | 3197 | "AF", 3198 | "AX", 3199 | "AL", 3200 | "DZ", 3201 | "AS", 3202 | "AD", 3203 | "AO", 3204 | "AI", 3205 | "AQ", 3206 | "AG", 3207 | "AR", 3208 | "AM", 3209 | "AW", 3210 | "AU", 3211 | "AT", 3212 | "AZ", 3213 | "BS", 3214 | "BH", 3215 | "BD", 3216 | "BB", 3217 | "BY", 3218 | "BE", 3219 | "BZ", 3220 | "BJ", 3221 | "BM", 3222 | "BT", 3223 | "BO", 3224 | "BQ", 3225 | "BA", 3226 | "BW", 3227 | "BV", 3228 | "BR", 3229 | "IO", 3230 | "BN", 3231 | "BG", 3232 | "BF", 3233 | "BI", 3234 | "CV", 3235 | "KH", 3236 | "CM", 3237 | "CA", 3238 | "KY", 3239 | "CF", 3240 | "TD", 3241 | "CL", 3242 | "CN", 3243 | "CX", 3244 | "CC", 3245 | "CO", 3246 | "KM", 3247 | "CG", 3248 | "CD", 3249 | "CK", 3250 | "CR", 3251 | "CI", 3252 | "HR", 3253 | "CU", 3254 | "CW", 3255 | "CY", 3256 | "CZ", 3257 | "DK", 3258 | "DJ", 3259 | "DM", 3260 | "DO", 3261 | "EC", 3262 | "EG", 3263 | "SV", 3264 | "GQ", 3265 | "ER", 3266 | "EE", 3267 | "SZ", 3268 | "ET", 3269 | "FK", 3270 | "FO", 3271 | "FJ", 3272 | "FI", 3273 | "FR", 3274 | "GF", 3275 | "PF", 3276 | "TF", 3277 | "GA", 3278 | "GM", 3279 | "GE", 3280 | "DE", 3281 | "GH", 3282 | "GI", 3283 | "GR", 3284 | "GL", 3285 | "GD", 3286 | "GP", 3287 | "GU", 3288 | "GT", 3289 | "GG", 3290 | "GN", 3291 | "GW", 3292 | "GY", 3293 | "HT", 3294 | "HM", 3295 | "VA", 3296 | "HN", 3297 | "HK", 3298 | "HU", 3299 | "IS", 3300 | "IN", 3301 | "ID", 3302 | "IR", 3303 | "IQ", 3304 | "IE", 3305 | "IM", 3306 | "IL", 3307 | "IT", 3308 | "JM", 3309 | "JP", 3310 | "JE", 3311 | "JO", 3312 | "KZ", 3313 | "KE", 3314 | "KI", 3315 | "KP", 3316 | "KR", 3317 | "KW", 3318 | "KG", 3319 | "LA", 3320 | "LV", 3321 | "LB", 3322 | "LS", 3323 | "LR", 3324 | "LY", 3325 | "LI", 3326 | "LT", 3327 | "LU", 3328 | "MO", 3329 | "MG", 3330 | "MW", 3331 | "MY", 3332 | "MV", 3333 | "ML", 3334 | "MT", 3335 | "MH", 3336 | "MQ", 3337 | "MR", 3338 | "MU", 3339 | "YT", 3340 | "MX", 3341 | "FM", 3342 | "MD", 3343 | "MC", 3344 | "MN", 3345 | "ME", 3346 | "MS", 3347 | "MA", 3348 | "MZ", 3349 | "MM", 3350 | "NA", 3351 | "NR", 3352 | "NP", 3353 | "NL", 3354 | "NC", 3355 | "NZ", 3356 | "NI", 3357 | "NE", 3358 | "NG", 3359 | "NU", 3360 | "NF", 3361 | "MK", 3362 | "MP", 3363 | "NO", 3364 | "OM", 3365 | "PK", 3366 | "PW", 3367 | "PS", 3368 | "PA", 3369 | "PG", 3370 | "PY", 3371 | "PE", 3372 | "PH", 3373 | "PN", 3374 | "PL", 3375 | "PT", 3376 | "PR", 3377 | "QA", 3378 | "RE", 3379 | "RO", 3380 | "RU", 3381 | "RW", 3382 | "BL", 3383 | "SH", 3384 | "KN", 3385 | "LC", 3386 | "MF", 3387 | "PM", 3388 | "VC", 3389 | "WS", 3390 | "SM", 3391 | "ST", 3392 | "SA", 3393 | "SN", 3394 | "RS", 3395 | "SC", 3396 | "SL", 3397 | "SG", 3398 | "SX", 3399 | "SK", 3400 | "SI", 3401 | "SB", 3402 | "SO", 3403 | "ZA", 3404 | "GS", 3405 | "SS", 3406 | "ES", 3407 | "LK", 3408 | "SD", 3409 | "SR", 3410 | "SJ", 3411 | "SE", 3412 | "CH", 3413 | "SY", 3414 | "TW", 3415 | "TJ", 3416 | "TZ", 3417 | "TH", 3418 | "TL", 3419 | "TG", 3420 | "TK", 3421 | "TO", 3422 | "TT", 3423 | "TN", 3424 | "TR", 3425 | "TM", 3426 | "TC", 3427 | "TV", 3428 | "UG", 3429 | "UA", 3430 | "AE", 3431 | "GB", 3432 | "US", 3433 | "UM", 3434 | "UY", 3435 | "UZ", 3436 | "VU", 3437 | "VE", 3438 | "VN", 3439 | "VG", 3440 | "VI", 3441 | "WF", 3442 | "EH", 3443 | "YE", 3444 | "ZM", 3445 | "ZW", 3446 | 3447 | 3448 | ]; 3449 | 3450 | 3451 | ///ALL the alpha3 codes of Countrys 3452 | pub const ALL_ALPHA3: & [&str] = &[ 3453 | 3454 | 3455 | "AFG", 3456 | "ALA", 3457 | "ALB", 3458 | "DZA", 3459 | "ASM", 3460 | "AND", 3461 | "AGO", 3462 | "AIA", 3463 | "ATA", 3464 | "ATG", 3465 | "ARG", 3466 | "ARM", 3467 | "ABW", 3468 | "AUS", 3469 | "AUT", 3470 | "AZE", 3471 | "BHS", 3472 | "BHR", 3473 | "BGD", 3474 | "BRB", 3475 | "BLR", 3476 | "BEL", 3477 | "BLZ", 3478 | "BEN", 3479 | "BMU", 3480 | "BTN", 3481 | "BOL", 3482 | "BES", 3483 | "BIH", 3484 | "BWA", 3485 | "BVT", 3486 | "BRA", 3487 | "IOT", 3488 | "BRN", 3489 | "BGR", 3490 | "BFA", 3491 | "BDI", 3492 | "CPV", 3493 | "KHM", 3494 | "CMR", 3495 | "CAN", 3496 | "CYM", 3497 | "CAF", 3498 | "TCD", 3499 | "CHL", 3500 | "CHN", 3501 | "CXR", 3502 | "CCK", 3503 | "COL", 3504 | "COM", 3505 | "COG", 3506 | "COD", 3507 | "COK", 3508 | "CRI", 3509 | "CIV", 3510 | "HRV", 3511 | "CUB", 3512 | "CUW", 3513 | "CYP", 3514 | "CZE", 3515 | "DNK", 3516 | "DJI", 3517 | "DMA", 3518 | "DOM", 3519 | "ECU", 3520 | "EGY", 3521 | "SLV", 3522 | "GNQ", 3523 | "ERI", 3524 | "EST", 3525 | "SWZ", 3526 | "ETH", 3527 | "FLK", 3528 | "FRO", 3529 | "FJI", 3530 | "FIN", 3531 | "FRA", 3532 | "GUF", 3533 | "PYF", 3534 | "ATF", 3535 | "GAB", 3536 | "GMB", 3537 | "GEO", 3538 | "DEU", 3539 | "GHA", 3540 | "GIB", 3541 | "GRC", 3542 | "GRL", 3543 | "GRD", 3544 | "GLP", 3545 | "GUM", 3546 | "GTM", 3547 | "GGY", 3548 | "GIN", 3549 | "GNB", 3550 | "GUY", 3551 | "HTI", 3552 | "HMD", 3553 | "VAT", 3554 | "HND", 3555 | "HKG", 3556 | "HUN", 3557 | "ISL", 3558 | "IND", 3559 | "IDN", 3560 | "IRN", 3561 | "IRQ", 3562 | "IRL", 3563 | "IMN", 3564 | "ISR", 3565 | "ITA", 3566 | "JAM", 3567 | "JPN", 3568 | "JEY", 3569 | "JOR", 3570 | "KAZ", 3571 | "KEN", 3572 | "KIR", 3573 | "PRK", 3574 | "KOR", 3575 | "KWT", 3576 | "KGZ", 3577 | "LAO", 3578 | "LVA", 3579 | "LBN", 3580 | "LSO", 3581 | "LBR", 3582 | "LBY", 3583 | "LIE", 3584 | "LTU", 3585 | "LUX", 3586 | "MAC", 3587 | "MDG", 3588 | "MWI", 3589 | "MYS", 3590 | "MDV", 3591 | "MLI", 3592 | "MLT", 3593 | "MHL", 3594 | "MTQ", 3595 | "MRT", 3596 | "MUS", 3597 | "MYT", 3598 | "MEX", 3599 | "FSM", 3600 | "MDA", 3601 | "MCO", 3602 | "MNG", 3603 | "MNE", 3604 | "MSR", 3605 | "MAR", 3606 | "MOZ", 3607 | "MMR", 3608 | "NAM", 3609 | "NRU", 3610 | "NPL", 3611 | "NLD", 3612 | "NCL", 3613 | "NZL", 3614 | "NIC", 3615 | "NER", 3616 | "NGA", 3617 | "NIU", 3618 | "NFK", 3619 | "MKD", 3620 | "MNP", 3621 | "NOR", 3622 | "OMN", 3623 | "PAK", 3624 | "PLW", 3625 | "PSE", 3626 | "PAN", 3627 | "PNG", 3628 | "PRY", 3629 | "PER", 3630 | "PHL", 3631 | "PCN", 3632 | "POL", 3633 | "PRT", 3634 | "PRI", 3635 | "QAT", 3636 | "REU", 3637 | "ROU", 3638 | "RUS", 3639 | "RWA", 3640 | "BLM", 3641 | "SHN", 3642 | "KNA", 3643 | "LCA", 3644 | "MAF", 3645 | "SPM", 3646 | "VCT", 3647 | "WSM", 3648 | "SMR", 3649 | "STP", 3650 | "SAU", 3651 | "SEN", 3652 | "SRB", 3653 | "SYC", 3654 | "SLE", 3655 | "SGP", 3656 | "SXM", 3657 | "SVK", 3658 | "SVN", 3659 | "SLB", 3660 | "SOM", 3661 | "ZAF", 3662 | "SGS", 3663 | "SSD", 3664 | "ESP", 3665 | "LKA", 3666 | "SDN", 3667 | "SUR", 3668 | "SJM", 3669 | "SWE", 3670 | "CHE", 3671 | "SYR", 3672 | "TWN", 3673 | "TJK", 3674 | "TZA", 3675 | "THA", 3676 | "TLS", 3677 | "TGO", 3678 | "TKL", 3679 | "TON", 3680 | "TTO", 3681 | "TUN", 3682 | "TUR", 3683 | "TKM", 3684 | "TCA", 3685 | "TUV", 3686 | "UGA", 3687 | "UKR", 3688 | "ARE", 3689 | "GBR", 3690 | "USA", 3691 | "UMI", 3692 | "URY", 3693 | "UZB", 3694 | "VUT", 3695 | "VEN", 3696 | "VNM", 3697 | "VGB", 3698 | "VIR", 3699 | "WLF", 3700 | "ESH", 3701 | "YEM", 3702 | "ZMB", 3703 | "ZWE", 3704 | 3705 | 3706 | ]; 3707 | 3708 | 3709 | ///ALL the 3 length numeric str codes of Countrys 3710 | pub const ALL_NUMERIC_STR: & [&str] = &[ 3711 | 3712 | 3713 | "004", 3714 | "248", 3715 | "008", 3716 | "012", 3717 | "016", 3718 | "020", 3719 | "024", 3720 | "660", 3721 | "010", 3722 | "028", 3723 | "032", 3724 | "051", 3725 | "533", 3726 | "036", 3727 | "040", 3728 | "031", 3729 | "044", 3730 | "048", 3731 | "050", 3732 | "052", 3733 | "112", 3734 | "056", 3735 | "084", 3736 | "204", 3737 | "060", 3738 | "064", 3739 | "068", 3740 | "535", 3741 | "070", 3742 | "072", 3743 | "074", 3744 | "076", 3745 | "086", 3746 | "096", 3747 | "100", 3748 | "854", 3749 | "108", 3750 | "132", 3751 | "116", 3752 | "120", 3753 | "124", 3754 | "136", 3755 | "140", 3756 | "148", 3757 | "152", 3758 | "156", 3759 | "162", 3760 | "166", 3761 | "170", 3762 | "174", 3763 | "178", 3764 | "180", 3765 | "184", 3766 | "188", 3767 | "384", 3768 | "191", 3769 | "192", 3770 | "531", 3771 | "196", 3772 | "203", 3773 | "208", 3774 | "262", 3775 | "212", 3776 | "214", 3777 | "218", 3778 | "818", 3779 | "222", 3780 | "226", 3781 | "232", 3782 | "233", 3783 | "748", 3784 | "231", 3785 | "238", 3786 | "234", 3787 | "242", 3788 | "246", 3789 | "250", 3790 | "254", 3791 | "258", 3792 | "260", 3793 | "266", 3794 | "270", 3795 | "268", 3796 | "276", 3797 | "288", 3798 | "292", 3799 | "300", 3800 | "304", 3801 | "308", 3802 | "312", 3803 | "316", 3804 | "320", 3805 | "831", 3806 | "324", 3807 | "624", 3808 | "328", 3809 | "332", 3810 | "334", 3811 | "336", 3812 | "340", 3813 | "344", 3814 | "348", 3815 | "352", 3816 | "356", 3817 | "360", 3818 | "364", 3819 | "368", 3820 | "372", 3821 | "833", 3822 | "376", 3823 | "380", 3824 | "388", 3825 | "392", 3826 | "832", 3827 | "400", 3828 | "398", 3829 | "404", 3830 | "296", 3831 | "408", 3832 | "410", 3833 | "414", 3834 | "417", 3835 | "418", 3836 | "428", 3837 | "422", 3838 | "426", 3839 | "430", 3840 | "434", 3841 | "438", 3842 | "440", 3843 | "442", 3844 | "446", 3845 | "450", 3846 | "454", 3847 | "458", 3848 | "462", 3849 | "466", 3850 | "470", 3851 | "584", 3852 | "474", 3853 | "478", 3854 | "480", 3855 | "175", 3856 | "484", 3857 | "583", 3858 | "498", 3859 | "492", 3860 | "496", 3861 | "499", 3862 | "500", 3863 | "504", 3864 | "508", 3865 | "104", 3866 | "516", 3867 | "520", 3868 | "524", 3869 | "528", 3870 | "540", 3871 | "554", 3872 | "558", 3873 | "562", 3874 | "566", 3875 | "570", 3876 | "574", 3877 | "807", 3878 | "580", 3879 | "578", 3880 | "512", 3881 | "586", 3882 | "585", 3883 | "275", 3884 | "591", 3885 | "598", 3886 | "600", 3887 | "604", 3888 | "608", 3889 | "612", 3890 | "616", 3891 | "620", 3892 | "630", 3893 | "634", 3894 | "638", 3895 | "642", 3896 | "643", 3897 | "646", 3898 | "652", 3899 | "654", 3900 | "659", 3901 | "662", 3902 | "663", 3903 | "666", 3904 | "670", 3905 | "882", 3906 | "674", 3907 | "678", 3908 | "682", 3909 | "686", 3910 | "688", 3911 | "690", 3912 | "694", 3913 | "702", 3914 | "534", 3915 | "703", 3916 | "705", 3917 | "090", 3918 | "706", 3919 | "710", 3920 | "239", 3921 | "728", 3922 | "724", 3923 | "144", 3924 | "729", 3925 | "740", 3926 | "744", 3927 | "752", 3928 | "756", 3929 | "760", 3930 | "158", 3931 | "762", 3932 | "834", 3933 | "764", 3934 | "626", 3935 | "768", 3936 | "772", 3937 | "776", 3938 | "780", 3939 | "788", 3940 | "792", 3941 | "795", 3942 | "796", 3943 | "798", 3944 | "800", 3945 | "804", 3946 | "784", 3947 | "826", 3948 | "840", 3949 | "581", 3950 | "858", 3951 | "860", 3952 | "548", 3953 | "862", 3954 | "704", 3955 | "092", 3956 | "850", 3957 | "876", 3958 | "732", 3959 | "887", 3960 | "894", 3961 | "716", 3962 | 3963 | 3964 | ]; 3965 | 3966 | 3967 | ///ALL the numeric codes of Countrys 3968 | pub const ALL_NUMERIC: & [i32] = &[ 3969 | 3970 | 3971 | 4, 3972 | 248, 3973 | 8, 3974 | 12, 3975 | 16, 3976 | 20, 3977 | 24, 3978 | 660, 3979 | 10, 3980 | 28, 3981 | 32, 3982 | 51, 3983 | 533, 3984 | 36, 3985 | 40, 3986 | 31, 3987 | 44, 3988 | 48, 3989 | 50, 3990 | 52, 3991 | 112, 3992 | 56, 3993 | 84, 3994 | 204, 3995 | 60, 3996 | 64, 3997 | 68, 3998 | 535, 3999 | 70, 4000 | 72, 4001 | 74, 4002 | 76, 4003 | 86, 4004 | 96, 4005 | 100, 4006 | 854, 4007 | 108, 4008 | 132, 4009 | 116, 4010 | 120, 4011 | 124, 4012 | 136, 4013 | 140, 4014 | 148, 4015 | 152, 4016 | 156, 4017 | 162, 4018 | 166, 4019 | 170, 4020 | 174, 4021 | 178, 4022 | 180, 4023 | 184, 4024 | 188, 4025 | 384, 4026 | 191, 4027 | 192, 4028 | 531, 4029 | 196, 4030 | 203, 4031 | 208, 4032 | 262, 4033 | 212, 4034 | 214, 4035 | 218, 4036 | 818, 4037 | 222, 4038 | 226, 4039 | 232, 4040 | 233, 4041 | 748, 4042 | 231, 4043 | 238, 4044 | 234, 4045 | 242, 4046 | 246, 4047 | 250, 4048 | 254, 4049 | 258, 4050 | 260, 4051 | 266, 4052 | 270, 4053 | 268, 4054 | 276, 4055 | 288, 4056 | 292, 4057 | 300, 4058 | 304, 4059 | 308, 4060 | 312, 4061 | 316, 4062 | 320, 4063 | 831, 4064 | 324, 4065 | 624, 4066 | 328, 4067 | 332, 4068 | 334, 4069 | 336, 4070 | 340, 4071 | 344, 4072 | 348, 4073 | 352, 4074 | 356, 4075 | 360, 4076 | 364, 4077 | 368, 4078 | 372, 4079 | 833, 4080 | 376, 4081 | 380, 4082 | 388, 4083 | 392, 4084 | 832, 4085 | 400, 4086 | 398, 4087 | 404, 4088 | 296, 4089 | 408, 4090 | 410, 4091 | 414, 4092 | 417, 4093 | 418, 4094 | 428, 4095 | 422, 4096 | 426, 4097 | 430, 4098 | 434, 4099 | 438, 4100 | 440, 4101 | 442, 4102 | 446, 4103 | 450, 4104 | 454, 4105 | 458, 4106 | 462, 4107 | 466, 4108 | 470, 4109 | 584, 4110 | 474, 4111 | 478, 4112 | 480, 4113 | 175, 4114 | 484, 4115 | 583, 4116 | 498, 4117 | 492, 4118 | 496, 4119 | 499, 4120 | 500, 4121 | 504, 4122 | 508, 4123 | 104, 4124 | 516, 4125 | 520, 4126 | 524, 4127 | 528, 4128 | 540, 4129 | 554, 4130 | 558, 4131 | 562, 4132 | 566, 4133 | 570, 4134 | 574, 4135 | 807, 4136 | 580, 4137 | 578, 4138 | 512, 4139 | 586, 4140 | 585, 4141 | 275, 4142 | 591, 4143 | 598, 4144 | 600, 4145 | 604, 4146 | 608, 4147 | 612, 4148 | 616, 4149 | 620, 4150 | 630, 4151 | 634, 4152 | 638, 4153 | 642, 4154 | 643, 4155 | 646, 4156 | 652, 4157 | 654, 4158 | 659, 4159 | 662, 4160 | 663, 4161 | 666, 4162 | 670, 4163 | 882, 4164 | 674, 4165 | 678, 4166 | 682, 4167 | 686, 4168 | 688, 4169 | 690, 4170 | 694, 4171 | 702, 4172 | 534, 4173 | 703, 4174 | 705, 4175 | 90, 4176 | 706, 4177 | 710, 4178 | 239, 4179 | 728, 4180 | 724, 4181 | 144, 4182 | 729, 4183 | 740, 4184 | 744, 4185 | 752, 4186 | 756, 4187 | 760, 4188 | 158, 4189 | 762, 4190 | 834, 4191 | 764, 4192 | 626, 4193 | 768, 4194 | 772, 4195 | 776, 4196 | 780, 4197 | 788, 4198 | 792, 4199 | 795, 4200 | 796, 4201 | 798, 4202 | 800, 4203 | 804, 4204 | 784, 4205 | 826, 4206 | 840, 4207 | 581, 4208 | 858, 4209 | 860, 4210 | 548, 4211 | 862, 4212 | 704, 4213 | 92, 4214 | 850, 4215 | 876, 4216 | 732, 4217 | 887, 4218 | 894, 4219 | 716, 4220 | 4221 | 4222 | ]; 4223 | 4224 | 4225 | ///ALL the Countrys struct 4226 | pub const ALL: & [CountryCode] = &[ 4227 | 4228 | 4229 | AF, 4230 | AX, 4231 | AL, 4232 | DZ, 4233 | AS, 4234 | AD, 4235 | AO, 4236 | AI, 4237 | AQ, 4238 | AG, 4239 | AR, 4240 | AM, 4241 | AW, 4242 | AU, 4243 | AT, 4244 | AZ, 4245 | BS, 4246 | BH, 4247 | BD, 4248 | BB, 4249 | BY, 4250 | BE, 4251 | BZ, 4252 | BJ, 4253 | BM, 4254 | BT, 4255 | BO, 4256 | BQ, 4257 | BA, 4258 | BW, 4259 | BV, 4260 | BR, 4261 | IO, 4262 | BN, 4263 | BG, 4264 | BF, 4265 | BI, 4266 | CV, 4267 | KH, 4268 | CM, 4269 | CA, 4270 | KY, 4271 | CF, 4272 | TD, 4273 | CL, 4274 | CN, 4275 | CX, 4276 | CC, 4277 | CO, 4278 | KM, 4279 | CG, 4280 | CD, 4281 | CK, 4282 | CR, 4283 | CI, 4284 | HR, 4285 | CU, 4286 | CW, 4287 | CY, 4288 | CZ, 4289 | DK, 4290 | DJ, 4291 | DM, 4292 | DO, 4293 | EC, 4294 | EG, 4295 | SV, 4296 | GQ, 4297 | ER, 4298 | EE, 4299 | SZ, 4300 | ET, 4301 | FK, 4302 | FO, 4303 | FJ, 4304 | FI, 4305 | FR, 4306 | GF, 4307 | PF, 4308 | TF, 4309 | GA, 4310 | GM, 4311 | GE, 4312 | DE, 4313 | GH, 4314 | GI, 4315 | GR, 4316 | GL, 4317 | GD, 4318 | GP, 4319 | GU, 4320 | GT, 4321 | GG, 4322 | GN, 4323 | GW, 4324 | GY, 4325 | HT, 4326 | HM, 4327 | VA, 4328 | HN, 4329 | HK, 4330 | HU, 4331 | IS, 4332 | IN, 4333 | ID, 4334 | IR, 4335 | IQ, 4336 | IE, 4337 | IM, 4338 | IL, 4339 | IT, 4340 | JM, 4341 | JP, 4342 | JE, 4343 | JO, 4344 | KZ, 4345 | KE, 4346 | KI, 4347 | KP, 4348 | KR, 4349 | KW, 4350 | KG, 4351 | LA, 4352 | LV, 4353 | LB, 4354 | LS, 4355 | LR, 4356 | LY, 4357 | LI, 4358 | LT, 4359 | LU, 4360 | MO, 4361 | MG, 4362 | MW, 4363 | MY, 4364 | MV, 4365 | ML, 4366 | MT, 4367 | MH, 4368 | MQ, 4369 | MR, 4370 | MU, 4371 | YT, 4372 | MX, 4373 | FM, 4374 | MD, 4375 | MC, 4376 | MN, 4377 | ME, 4378 | MS, 4379 | MA, 4380 | MZ, 4381 | MM, 4382 | NA, 4383 | NR, 4384 | NP, 4385 | NL, 4386 | NC, 4387 | NZ, 4388 | NI, 4389 | NE, 4390 | NG, 4391 | NU, 4392 | NF, 4393 | MK, 4394 | MP, 4395 | NO, 4396 | OM, 4397 | PK, 4398 | PW, 4399 | PS, 4400 | PA, 4401 | PG, 4402 | PY, 4403 | PE, 4404 | PH, 4405 | PN, 4406 | PL, 4407 | PT, 4408 | PR, 4409 | QA, 4410 | RE, 4411 | RO, 4412 | RU, 4413 | RW, 4414 | BL, 4415 | SH, 4416 | KN, 4417 | LC, 4418 | MF, 4419 | PM, 4420 | VC, 4421 | WS, 4422 | SM, 4423 | ST, 4424 | SA, 4425 | SN, 4426 | RS, 4427 | SC, 4428 | SL, 4429 | SG, 4430 | SX, 4431 | SK, 4432 | SI, 4433 | SB, 4434 | SO, 4435 | ZA, 4436 | GS, 4437 | SS, 4438 | ES, 4439 | LK, 4440 | SD, 4441 | SR, 4442 | SJ, 4443 | SE, 4444 | CH, 4445 | SY, 4446 | TW, 4447 | TJ, 4448 | TZ, 4449 | TH, 4450 | TL, 4451 | TG, 4452 | TK, 4453 | TO, 4454 | TT, 4455 | TN, 4456 | TR, 4457 | TM, 4458 | TC, 4459 | TV, 4460 | UG, 4461 | UA, 4462 | AE, 4463 | GB, 4464 | US, 4465 | UM, 4466 | UY, 4467 | UZ, 4468 | VU, 4469 | VE, 4470 | VN, 4471 | VG, 4472 | VI, 4473 | WF, 4474 | EH, 4475 | YE, 4476 | ZM, 4477 | ZW, 4478 | 4479 | 4480 | ]; 4481 | 4482 | --------------------------------------------------------------------------------