Enum keshvar::Alpha3

source ·
pub enum Alpha3 {
Show 249 variants AND, ARE, AFG, ATG, AIA, ALB, ARM, AGO, ATA, ARG, ASM, AUT, AUS, ABW, ALA, AZE, BIH, BRB, BGD, BEL, BFA, BGR, BHR, BDI, BEN, BLM, BMU, BRN, BOL, BES, BRA, BHS, BTN, BVT, BWA, BLR, BLZ, CAN, CCK, COD, CAF, COG, CHE, CIV, COK, CHL, CMR, CHN, COL, CRI, CUB, CPV, CUW, CXR, CYP, CZE, DEU, DJI, DNK, DMA, DOM, DZA, ECU, EST, EGY, ESH, ERI, ESP, ETH, FIN, FJI, FLK, FSM, FRO, FRA, GAB, GBR, GRD, GEO, GUF, GGY, GHA, GIB, GRL, GMB, GIN, GLP, GNQ, GRC, SGS, GTM, GUM, GNB, GUY, HKG, HMD, HND, HRV, HTI, HUN, IDN, IRL, ISR, IMN, IND, IOT, IRQ, IRN, ISL, ITA, JEY, JAM, JOR, JPN, KEN, KGZ, KHM, KIR, COM, KNA, PRK, KOR, KWT, CYM, KAZ, LAO, LBN, LCA, LIE, LKA, LBR, LSO, LTU, LUX, LVA, LBY, MAR, MCO, MDA, MNE, MAF, MDG, MHL, MKD, MLI, MMR, MNG, MAC, MNP, MTQ, MRT, MSR, MLT, MUS, MDV, MWI, MEX, MYS, MOZ, NAM, NCL, NER, NFK, NGA, NIC, NLD, NOR, NPL, NRU, NIU, NZL, OMN, PAN, PER, PYF, PNG, PHL, PAK, POL, SPM, PCN, PRI, PSE, PRT, PLW, PRY, QAT, REU, ROU, SRB, RUS, RWA, SAU, SLB, SYC, SDN, SWE, SGP, SHN, SVN, SJM, SVK, SLE, SMR, SEN, SOM, SUR, SSD, STP, SLV, SXM, SYR, SWZ, TCA, TCD, ATF, TGO, THA, TJK, TKL, TLS, TKM, TUN, TON, TUR, TTO, TUV, TWN, TZA, UKR, UGA, UMI, USA, URY, UZB, VAT, VCT, VEN, VGB, VIR, VNM, VUT, WLF, WSM, YEM, MYT, ZAF, ZMB, ZWE,
}
Expand description

An enum containing Alpha3 codes for all countries.

All countries features are enabled by default. You can disable default features and enabled features for all countries that you need.

§Examples

use keshvar::{Alpha2, Alpha3, Country, SearchError, SearchedItems};

assert_eq!(Ok(Alpha3::USA), Alpha3::try_from("usa")); // not case-sensitive
assert_eq!("USA", Alpha3::USA.to_string().as_str());

// If enabled all countries features:
assert_eq!(
    Err(SearchError::NotFound {
        searched_items: SearchedItems::AllCountries
    }),
    Alpha3::try_from("xxx")
);
assert_eq!(
    Err("Could not be found in all countries".to_string()),
    Alpha3::try_from("xxx").map_err(|error| error.to_string())
);

// If enabled some countries features:
// For example we enabled supporting just 10 countries and the US
// is not one of them:
// assert_eq!(
//     Err(SearchError::NotFound {
//         searched_items: SearchedItems::SupportedCountries(10)
//     }),
//     Alpha3::try_from("usa")
// );
// assert_eq!(
//     Err("Could not be found in 10 supported countries".to_string()),
//     Alpha3::try_from("usa").map_err(|error| error.to_string())
// );

// Convert to `Alpha2` code:
assert_eq!(Alpha2::US, Alpha3::USA.to_alpha2());
// Convert to `Country`:
let country: Country = Alpha3::USA.to_country();
// Get subdivisions of country:
let subdivisions = Alpha3::USA.to_subdivisions();

We usually need to convert it to Country and use that object instead.

§Panics

Most methods will panic if you do not enable any country feature!

Variants§

§

AND

The Principality of Andorra (Europe)

§

ARE

The United Arab Emirates (Asia)

§

AFG

The Islamic Republic of Afghanistan (Asia)

§

ATG

Antigua and Barbuda (Americas)

§

AIA

Anguilla (Americas)

§

ALB

The Republic of Albania (Europe)

§

ARM

The Republic of Armenia (Asia)

§

AGO

The Republic of Angola (Africa)

§

ATA

Antarctica

§

ARG

The Argentine Republic (Americas)

§

ASM

The Territory of American Samoa (Oceania)

§

AUT

The Republic of Austria (Europe)

§

AUS

The Commonwealth of Australia (Oceania)

§

ABW

Aruba (Americas)

§

ALA

Åland (Europe)

§

AZE

The Republic of Azerbaijan (Asia)

§

BIH

Bosnia and Herzegovina (Europe)

§

BRB

Barbados (Americas)

§

BGD

The People’s Republic of Bangladesh (Asia)

§

BEL

The Kingdom of Belgium (Europe)

§

BFA

Burkina Faso (Africa)

§

BGR

The Republic of Bulgaria (Europe)

§

BHR

The Kingdom of Bahrain (Asia)

§

BDI

The Republic of Burundi (Africa)

§

BEN

The Republic of Benin (Africa)

§

BLM

The Collectivity of Saint-Barthélemy (Americas)

§

BMU

Bermuda (Americas)

§

BRN

The Nation of Brunei, the Abode of Peace (Asia)

§

BOL

The Plurinational State of Bolivia (Americas)

§

BES

Bonaire, Sint Eustatius and Saba (Americas)

§

BRA

The Federative Republic of Brazil (Americas)

§

BHS

The Commonwealth of The Bahamas (Americas)

§

BTN

The Kingdom of Bhutan (Asia)

§

BVT

Bouvet Island

§

BWA

The Republic of Botswana (Africa)

§

BLR

The Republic of Belarus (Europe)

§

BLZ

Belize (Americas)

§

CAN

Canada (Americas)

§

CCK

The Territory of Cocos (Keeling) Islands (Oceania)

§

COD

The Democratic Republic of the Congo (Africa)

§

CAF

The Central African Republic (Africa)

§

COG

The Republic of the Congo (Africa)

§

CHE

The Swiss Confederation (Europe)

§

CIV

The Republic of Côte d’Ivoire (Africa)

§

COK

The Cook Islands (Oceania)

§

CHL

The Republic of Chile (Americas)

§

CMR

The Republic of Cameroon (Africa)

§

CHN

The People’s Republic of China (Asia)

§

COL

The Republic of Colombia (Americas)

§

CRI

The Republic of Costa Rica (Americas)

§

CUB

The Republic of Cuba (Americas)

§

CPV

The Republic of Cabo Verde (Africa)

§

CUW

The Country of Curaçao (Americas)

§

CXR

The Territory of Christmas Island (Oceania)

§

CYP

The Republic of Cyprus (Asia)

§

CZE

The Czech Republic (Europe)

§

DEU

The Federal Republic of Germany (Europe)

§

DJI

The Republic of Djibouti (Africa)

§

DNK

The Kingdom of Denmark (Europe)

§

DMA

The Commonwealth of Dominica (Americas)

§

DOM

The Dominican Republic (Americas)

§

DZA

The People’s Democratic Republic of Algeria (Africa)

§

ECU

The Republic of Ecuador (Americas)

§

EST

The Republic of Estonia (Europe)

§

EGY

The Arab Republic of Egypt (Africa)

§

ESH

The Sahrawi Arab Democratic Republic (Africa)

§

ERI

The State of Eritrea (Africa)

§

ESP

The Kingdom of Spain (Europe)

§

ETH

The Federal Democratic Republic of Ethiopia (Africa)

§

FIN

The Republic of Finland (Europe)

§

FJI

The Republic of Fiji (Oceania)

§

FLK

The Falkland Islands (Americas)

§

FSM

The Federated States of Micronesia (Oceania)

§

FRO

The Faroe Islands (Europe)

§

FRA

The French Republic (Europe)

§

GAB

The Gabonese Republic (Africa)

§

GBR

The United Kingdom of Great Britain and Northern Ireland (Europe)

§

GRD

Grenada (Americas)

§

GEO

Georgia (Asia)

§

GUF

Guyane (Americas)

§

GGY

The Bailiwick of Guernsey (Europe)

§

GHA

The Republic of Ghana (Africa)

§

GIB

Gibraltar (Europe)

§

GRL

Kalaallit Nunaat (Americas)

§

GMB

The Republic of The Gambia (Africa)

§

GIN

The Republic of Guinea (Africa)

§

GLP

Guadeloupe (Americas)

§

GNQ

The Republic of Equatorial Guinea (Africa)

§

GRC

The Hellenic Republic (Europe)

§

SGS

South Georgia and the South Sandwich Islands (Americas)

§

GTM

The Republic of Guatemala (Americas)

§

GUM

The Territory of Guam (Oceania)

§

GNB

The Republic of Guinea-Bissau (Africa)

§

GUY

The Co-operative Republic of Guyana (Americas)

§

HKG

The Hong Kong Special Administrative Region of China (Asia)

§

HMD

The Territory of Heard Island and McDonald Islands

§

HND

The Republic of Honduras (Americas)

§

HRV

The Republic of Croatia (Europe)

§

HTI

The Republic of Haiti (Americas)

§

HUN

Hungary (Europe)

§

IDN

The Republic of Indonesia (Asia)

§

IRL

Ireland (Europe)

§

ISR

The State of Israel (Asia)

§

IMN

The Isle of Man (Europe)

§

IND

The Republic of India (Asia)

§

IOT

The British Indian Ocean Territory (Africa)

§

IRQ

The Republic of Iraq (Asia)

§

IRN

The Islamic Republic of Iran (Asia)

§

ISL

Iceland (Europe)

§

ITA

The Italian Republic (Europe)

§

JEY

The Bailiwick of Jersey (Europe)

§

JAM

Jamaica (Americas)

§

JOR

The Hashemite Kingdom of Jordan (Asia)

§

JPN

Japan (Asia)

§

KEN

The Republic of Kenya (Africa)

§

KGZ

The Kyrgyz Republic (Asia)

§

KHM

The Kingdom of Cambodia (Asia)

§

KIR

The Republic of Kiribati (Oceania)

§

COM

The Union of the Comoros (Africa)

§

KNA

Saint Kitts and Nevis (Americas)

§

PRK

The Democratic People’s Republic of Korea (Asia)

§

KOR

The Republic of Korea (Asia)

§

KWT

The State of Kuwait (Asia)

§

CYM

The Cayman Islands (Americas)

§

KAZ

The Republic of Kazakhstan (Asia)

§

LAO

The Lao People’s Democratic Republic (Asia)

§

LBN

The Lebanese Republic (Asia)

§

LCA

Saint Lucia (Americas)

§

LIE

The Principality of Liechtenstein (Europe)

§

LKA

The Democratic Socialist Republic of Sri Lanka (Asia)

§

LBR

The Republic of Liberia (Africa)

§

LSO

The Kingdom of Lesotho (Africa)

§

LTU

The Republic of Lithuania (Europe)

§

LUX

The Grand Duchy of Luxembourg (Europe)

§

LVA

The Republic of Latvia (Europe)

§

LBY

The State of Libya (Africa)

§

MAR

The Kingdom of Morocco (Africa)

§

MCO

The Principality of Monaco (Europe)

§

MDA

The Republic of Moldova (Europe)

§

MNE

Montenegro (Europe)

§

MAF

The Collectivity of Saint-Martin (Americas)

§

MDG

The Republic of Madagascar (Africa)

§

MHL

The Republic of the Marshall Islands (Oceania)

§

MKD

The Republic of North Macedonia (Europe)

§

MLI

The Republic of Mali (Africa)

§

MMR

The Republic of the Union of Myanmar (Asia)

§

MNG

Mongolia (Asia)

§

MAC

The Macao Special Administrative Region of China (Asia)

§

MNP

The Commonwealth of the Northern Mariana Islands (Oceania)

§

MTQ

Martinique (Americas)

§

MRT

The Islamic Republic of Mauritania (Africa)

§

MSR

Montserrat (Americas)

§

MLT

The Republic of Malta (Europe)

§

MUS

The Republic of Mauritius (Africa)

§

MDV

The Republic of Maldives (Asia)

§

MWI

The Republic of Malawi (Africa)

§

MEX

The United Mexican States (Americas)

§

MYS

Malaysia (Asia)

§

MOZ

The Republic of Mozambique (Africa)

§

NAM

The Republic of Namibia (Africa)

§

NCL

New Caledonia (Oceania)

§

NER

The Republic of the Niger (Africa)

§

NFK

The Territory of Norfolk Island (Oceania)

§

NGA

The Federal Republic of Nigeria (Africa)

§

NIC

The Republic of Nicaragua (Americas)

§

NLD

The Kingdom of the Netherlands (Europe)

§

NOR

The Kingdom of Norway (Europe)

§

NPL

The Federal Democratic Republic of Nepal (Asia)

§

NRU

The Republic of Nauru (Oceania)

§

NIU

Niue (Oceania)

§

NZL

New Zealand (Oceania)

§

OMN

The Sultanate of Oman (Asia)

§

PAN

The Republic of Panamá (Americas)

§

PER

The Republic of Perú (Americas)

§

PYF

French Polynesia (Oceania)

§

PNG

The Independent State of Papua New Guinea (Oceania)

§

PHL

The Republic of the Philippines (Asia)

§

PAK

The Islamic Republic of Pakistan (Asia)

§

POL

The Republic of Poland (Europe)

§

SPM

The Overseas Collectivity of Saint-Pierre and Miquelon (Americas)

§

PCN

The Pitcairn, Henderson, Ducie and Oeno Islands (Oceania)

§

PRI

The Commonwealth of Puerto Rico (Americas)

§

PSE

The State of Palestine (Asia)

§

PRT

The Portuguese Republic (Europe)

§

PLW

The Republic of Palau (Oceania)

§

PRY

The Republic of Paraguay (Americas)

§

QAT

The State of Qatar (Asia)

§

REU

Réunion (Africa)

§

ROU

Romania (Europe)

§

SRB

The Republic of Serbia (Europe)

§

RUS

The Russian Federation (Europe)

§

RWA

The Republic of Rwanda (Africa)

§

SAU

The Kingdom of Saudi Arabia (Asia)

§

SLB

The Solomon Islands (Oceania)

§

SYC

The Republic of Seychelles (Africa)

§

SDN

The Republic of the Sudan (Africa)

§

SWE

The Kingdom of Sweden (Europe)

§

SGP

The Republic of Singapore (Asia)

§

SHN

Saint Helena, Ascension and Tristan da Cunha (Africa)

§

SVN

The Republic of Slovenia (Europe)

§

SJM

Svalbard and Jan Mayen (Europe)

§

SVK

The Slovak Republic (Europe)

§

SLE

The Republic of Sierra Leone (Africa)

§

SMR

The Republic of San Marino (Europe)

§

SEN

The Republic of Senegal (Africa)

§

SOM

The Federal Republic of Somalia (Africa)

§

SUR

The Republic of Suriname (Americas)

§

SSD

The Republic of South Sudan (Africa)

§

STP

The Democratic Republic of São Tomé and Príncipe (Africa)

§

SLV

The Republic of El Salvador (Americas)

§

SXM

Sint Maarten (Americas)

§

SYR

The Syrian Arab Republic (Asia)

§

SWZ

The Kingdom of Eswatini (Africa)

§

TCA

The Turks and Caicos Islands (Americas)

§

TCD

The Republic of Chad (Africa)

§

ATF

The French Southern and Antarctic Lands (Africa)

§

TGO

The Togolese Republic (Africa)

§

THA

The Kingdom of Thailand (Asia)

§

TJK

The Republic of Tajikistan (Asia)

§

TKL

Tokelau (Oceania)

§

TLS

The Democratic Republic of Timor-Leste (Asia)

§

TKM

Turkmenistan (Asia)

§

TUN

The Republic of Tunisia (Africa)

§

TON

The Kingdom of Tonga (Oceania)

§

TUR

The Republic of Türkiye (Asia)

§

TTO

The Republic of Trinidad and Tobago (Americas)

§

TUV

Tuvalu (Oceania)

§

TWN

Taiwan, Province of China (Asia)

§

TZA

The United Republic of Tanzania (Africa)

§

UKR

Ukraine (Europe)

§

UGA

The Republic of Uganda (Africa)

§

UMI

United States Minor Outlying Islands (Americas)

§

USA

The United States of America (Americas)

§

URY

The Oriental Republic of Uruguay (Americas)

§

UZB

The Republic of Uzbekistan (Asia)

§

VAT

The Holy See (Europe)

§

VCT

Saint Vincent and the Grenadines (Americas)

§

VEN

The Bolivarian Republic of Venezuela (Americas)

§

VGB

The Virgin Islands (Americas)

§

VIR

The Virgin Islands of the United States (Americas)

§

VNM

The Socialist Republic of Viet Nam (Asia)

§

VUT

The Republic of Vanuatu (Oceania)

§

WLF

The Territory of the Wallis and Futuna Islands (Oceania)

§

WSM

The Independent State of Samoa (Oceania)

§

YEM

The Republic of Yemen (Asia)

§

MYT

The Department of Mayotte (Africa)

§

ZAF

The Republic of South Africa (Africa)

§

ZMB

The Republic of Zambia (Africa)

§

ZWE

The Republic of Zimbabwe (Africa)

Implementations§

Trait Implementations§

source§

impl Clone for Alpha3

source§

fn clone(&self) -> Alpha3

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Alpha3

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Alpha3

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Alpha2> for Alpha3

source§

fn from(alpha2: Alpha2) -> Self

Converts to this type from the input type.
source§

impl From<Alpha3> for Alpha2

source§

fn from(alpha3: Alpha3) -> Self

Converts to this type from the input type.
source§

impl From<Alpha3> for Country

source§

fn from(alpha3: Alpha3) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Alpha3

source§

fn eq(&self, other: &Alpha3) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Alpha3

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToString for Alpha3

source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl TryFrom<&str> for Alpha3

§

type Error = SearchError

The type returned in the event of a conversion error.
source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for Alpha3

source§

impl StructuralPartialEq for Alpha3

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,