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

An enumeration of all ISO-3166-1 country codes

Variants§

§

AFG

Afghanistan

§

ALA

Åland Islands

§

ALB

Albania

§

DZA

Algeria

§

ASM

American Samoa

§

AND

Andorra

§

AGO

Angola

§

AIA

Anguilla

§

ATA

Antarctica

§

ATG

Antigua and Barbuda

§

ARG

Argentina

§

ARM

Armenia

§

ABW

Aruba

§

AUS

Australia

§

AUT

Austria

§

AZE

Azerbaijan

§

BHS

Bahamas

§

BHR

Bahrain

§

BGD

Bangladesh

§

BRB

Barbados

§

BLR

Belarus

§

BEL

Belgium

§

BLZ

Belize

§

BEN

Benin

§

BMU

Bermuda

§

BTN

Bhutan

§

BOL

Bolivia (Plurinational State of)

§

BES

Bonaire, Sint Eustatius and Saba

§

BIH

Bosnia and Herzegovina

§

BWA

Botswana

§

BVT

Bouvet Island

§

BRA

Brazil

§

IOT

British Indian Ocean Territory

§

BRN

Brunei Darussalam

§

BGR

Bulgaria

§

BFA

Burkina Faso

§

BDI

Burundi

§

CPV

Cabo Verde

§

KHM

Cambodia

§

CMR

Cameroon

§

CAN

Canada

§

CYM

Cayman Islands

§

CAF

Central African Republic

§

TCD

Chad

§

CHL

Chile

§

CHN

China

§

CXR

Christmas Island

§

CCK

Cocos (Keeling) Islands

§

COL

Colombia

§

COM

Comoros

§

COG

Congo

§

COD

Congo (Democratic Republic of the)

§

COK

Cook Islands

§

CRI

Costa Rica

§

CIV

Côte d’Ivoire

§

HRV

Croatia

§

CUB

Cuba

§

CUW

Curaçao

§

CYP

Cyprus

§

CZE

Czechia

§

DNK

Denmark

§

DJI

Djibouti

§

DMA

Dominica

§

DOM

Dominican Republic

§

ECU

Ecuador

§

EGY

Egypt

§

SLV

El Salvador

§

GNQ

Equatorial Guinea

§

ERI

Eritrea

§

EST

Estonia

§

ETH

Ethiopia

§

FLK

Falkland Islands (Malvinas)

§

FRO

Faroe Islands

§

FJI

Fiji

§

FIN

Finland

§

FRA

France

§

GUF

French Guiana

§

PYF

French Polynesia

§

ATF

French Southern Territories

§

GAB

Gabon

§

GMB

Gambia

§

GEO

Georgia

§

DEU

Germany

§

GHA

Ghana

§

GIB

Gibraltar

§

GRC

Greece

§

GRL

Greenland

§

GRD

Grenada

§

GLP

Guadeloupe

§

GUM

Guam

§

GTM

Guatemala

§

GGY

Guernsey

§

GIN

Guinea

§

GNB

Guinea-Bissau

§

GUY

Guyana

§

HTI

Haiti

§

HMD

Heard Island and McDonald Islands

§

VAT

Holy See

§

HND

Honduras

§

HKG

Hong Kong

§

HUN

Hungary

§

ISL

Iceland

§

IND

India

§

IDN

Indonesia

§

IRN

Iran (Islamic Republic of)

§

IRQ

Iraq

§

IRL

Ireland

§

IMN

Isle of Man

§

ISR

Israel

§

ITA

Italy

§

JAM

Jamaica

§

JPN

Japan

§

JEY

Jersey

§

JOR

Jordan

§

KAZ

Kazakhstan

§

KEN

Kenya

§

KIR

Kiribati

§

PRK

Korea (Democratic People’s Republic of)

§

KOR

Korea (Republic of)

§

KWT

Kuwait

§

KGZ

Kyrgyzstan

§

LAO

Lao People’s Democratic Republic

§

LVA

Latvia

§

LBN

Lebanon

§

LSO

Lesotho

§

LBR

Liberia

§

LBY

Libya

§

LIE

Liechtenstein

§

LTU

Lithuania

§

LUX

Luxembourg

§

MAC

Macao

§

MKD

Macedonia (the former Yugoslav Republic of)

§

MDG

Madagascar

§

MWI

Malawi

§

MYS

Malaysia

§

MDV

Maldives

§

MLI

Mali

§

MLT

Malta

§

MHL

Marshall Islands

§

MTQ

Martinique

§

MRT

Mauritania

§

MUS

Mauritius

§

MYT

Mayotte

§

MEX

Mexico

§

FSM

Micronesia (Federated States of)

§

MDA

Moldova (Republic of)

§

MCO

Monaco

§

MNG

Mongolia

§

MNE

Montenegro

§

MSR

Montserrat

§

MAR

Morocco

§

MOZ

Mozambique

§

MMR

Myanmar

§

NAM

Namibia

§

NRU

Nauru

§

NPL

Nepal

§

NLD

Netherlands

§

NCL

New Caledonia

§

NZL

New Zealand

§

NIC

Nicaragua

§

NER

Niger

§

NGA

Nigeria

§

NIU

Niue

§

NFK

Norfolk Island

§

MNP

Northern Mariana Islands

§

NOR

Norway

§

OMN

Oman

§

PAK

Pakistan

§

PLW

Palau

§

PSE

Palestine, State of

§

PAN

Panama

§

PNG

Papua New Guinea

§

PRY

Paraguay

§

PER

Peru

§

PHL

Philippines

§

PCN

Pitcairn

§

POL

Poland

§

PRT

Portugal

§

PRI

Puerto Rico

§

QAT

Qatar

§

REU

Réunion

§

ROU

Romania

§

RUS

Russian Federation

§

RWA

Rwanda

§

BLM

Saint Barthélemy

§

SHN

Saint Helena, Ascension and Tristan da Cunha

§

KNA

Saint Kitts and Nevis

§

LCA

Saint Lucia

§

MAF

Saint Martin (French part)

§

SPM

Saint Pierre and Miquelon

§

VCT

Saint Vincent and the Grenadines

§

WSM

Samoa

§

SMR

San Marino

§

STP

Sao Tome and Principe

§

SAU

Saudi Arabia

§

SEN

Senegal

§

SRB

Serbia

§

SYC

Seychelles

§

SLE

Sierra Leone

§

SGP

Singapore

§

SXM

Sint Maarten (Dutch part)

§

SVK

Slovakia

§

SVN

Slovenia

§

SLB

Solomon Islands

§

SOM

Somalia

§

ZAF

South Africa

§

SGS

South Georgia and the South Sandwich Islands

§

SSD

South Sudan

§

ESP

Spain

§

LKA

Sri Lanka

§

SDN

Sudan

§

SUR

Suriname

§

SJM

Svalbard and Jan Mayen

§

SWZ

Swaziland

§

SWE

Sweden

§

CHE

Switzerland

§

SYR

Syrian Arab Republic

§

TWN

Taiwan, Province of China

§

TJK

Tajikistan

§

TZA

Tanzania, United Republic of

§

THA

Thailand

§

TLS

Timor-Leste

§

TGO

Togo

§

TKL

Tokelau

§

TON

Tonga

§

TTO

Trinidad and Tobago

§

TUN

Tunisia

§

TUR

Turkey

§

TKM

Turkmenistan

§

TCA

Turks and Caicos Islands

§

TUV

Tuvalu

§

UGA

Uganda

§

UKR

Ukraine

§

ARE

United Arab Emirates

§

GBR

United Kingdom of Great Britain and Northern Ireland

§

USA

United States of America

§

UMI

United States Minor Outlying Islands

§

URY

Uruguay

§

UZB

Uzbekistan

§

VUT

Vanuatu

§

VEN

Venezuela (Bolivarian Republic of)

§

VNM

Viet Nam

§

VGB

Virgin Islands (British)

§

VIR

Virgin Islands (U.S.)

§

WLF

Wallis and Futuna

§

ESH

Western Sahara

§

YEM

Yemen

§

ZMB

Zambia

§

ZWE

Zimbabwe

Implementations§

source§

impl CountryCode

source

pub fn name(&self) -> &'static str

Returns the ISO 3166-1 English short name

source

pub fn numeric_id(&self) -> u32

Returns the ISO 3166-1 numeric ID

source

pub fn alpha2(&self) -> &'static str

Returns the uppercase two-character ISO 3166-1 string

source

pub fn alpha3(&self) -> &'static str

Returns the uppercase three-character ISO 3166-1 string

source

pub fn for_alpha2(value: &str) -> Result<CountryCode, CountryCodeParseErr>

Attempts to determine the ISO 3166-1 CountryCode for the given two-character string, assuming it is in upper-case characters

source

pub fn for_alpha2_caseless( value: &str ) -> Result<CountryCode, CountryCodeParseErr>

Attempts to determine the ISO 3166-1 CountryCode for the given two-character string, making no assumption as to the case-ness of the input

source

pub fn for_alpha3(value: &str) -> Result<CountryCode, CountryCodeParseErr>

Attempts to determine the ISO 3166-1 CountryCode for the given three-character string, assuming it is in upper-case characters

source

pub fn for_alpha3_caseless( value: &str ) -> Result<CountryCode, CountryCodeParseErr>

Attempts to determine the ISO 3166-1 CountryCode for the given three-character string, making no assumption as to the case-ness of the input

source

pub fn for_id(value: u32) -> Result<CountryCode, CountryCodeParseErr>

Attempts to determine the ISO 3166-1 CountryCode for the given unsigned integer

source

pub fn as_array() -> &'static [CountryCode; 249]

Returns an array of all CountryCode variants, sorted in ascending lexicographic order by the full name of the corresponding country

source

pub fn as_array_alpha2() -> &'static [CountryCode; 249]

Returns an array of all CountryCode variants, sorted in ascending lexicographic order by the alpha-2 code for the corresponding country

source

pub fn as_array_alpha3() -> &'static [CountryCode; 249]

Returns an iterator over all CountryCode variants, sorted in ascending lexicographic order by the alpha-3 code for the corresponding country

source

pub fn as_array_numeric() -> &'static [CountryCode; 249]

Returns an iterator over all CountryCode variants, sorted in ascending order by the numeric code for the corresponding country

source

pub fn iter() -> impl Iterator<Item = &'static CountryCode>

Returns an iterator over all CountryCode variants, sorted in ascending lexicographic order by the full name of the corresponding country

source

pub fn iter_alpha2() -> impl Iterator<Item = &'static CountryCode>

Returns an iterator over all CountryCode variants, sorted in ascending lexicographic order by the alpha-2 code for the corresponding country

source

pub fn iter_alpha3() -> impl Iterator<Item = &'static CountryCode>

Returns an iterator over all CountryCode variants, sorted in ascending lexicographic order by the alpha-3 code for the corresponding country

source

pub fn iter_numeric() -> impl Iterator<Item = &'static CountryCode>

Returns an iterator over all CountryCode variants, sorted in ascending order by the numeric code for the corresponding country

source

pub fn num_country_codes() -> usize

Returns the number of unique ISO 3166-1 defined country codes currently supported by this library.

Trait Implementations§

source§

impl Clone for CountryCode

source§

fn clone(&self) -> CountryCode

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 CountryCode

source§

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

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

impl<'de> Deserialize<'de> for CountryCode

source§

fn deserialize<D>( deserializer: D ) -> Result<CountryCode, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl Display for CountryCode

source§

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

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

impl Hash for CountryCode

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Into<u32> for CountryCode

source§

fn into(self) -> u32

Converts this type into the (usually inferred) input type.
source§

impl Ord for CountryCode

source§

fn cmp(&self, other: &CountryCode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for CountryCode

source§

fn eq(&self, other: &CountryCode) -> 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 PartialOrd for CountryCode

source§

fn partial_cmp(&self, other: &CountryCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for CountryCode

source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

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

impl Copy for CountryCode

source§

impl Eq for CountryCode

source§

impl StructuralPartialEq for CountryCode

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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