Crate codes_un_m49

source ·
Expand description

This package contains an implementation of the UN M49 Standard Country or Area Codes for Statistical Use (Series M, No. 49) specification.

UN M49 or the Standard Country or Area Codes for Statistical Use (Series M, No. 49) is a standard for area codes used by the United Nations for statistical purposes, developed and maintained by the United Nations Statistics Division. Each area code is a 3-digit number which can refer to a wide variety of geographical and political regions, like a continent and a country. Codes assigned in the system generally do not change when the country or area’s name changes (unlike ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3), but instead change when the territorial extent of the country or area changes significantly, although there have been exceptions to this rule.

Example

use codes_un_m49 as M49;

let region = M49::UN_M69_REGION_258;

assert_eq!(region.code(), 258);
assert_eq!(region.name(), "French Polynesia");
assert_eq!(region.kind(), M49::RegionKind::Country);

// feature = "country_codes"
// assert_eq!(parent.country_code(), Some(CountryCode::PF));
// or
// assert_eq!(region.country_code(), Some("PF"));

let parent = region.parent_code().unwrap();
assert_eq!(parent.code(), 61);
assert_eq!(parent.name(), "Polynesia");

let parent = parent.parent_code().unwrap();
assert_eq!(parent.code(), 9);
assert_eq!(parent.name(), "Oceania");

let parent = parent.parent_code().unwrap();
assert_eq!(parent.code(), 1);
assert_eq!(parent.name(), "World");

Features

By default only the serde feature is enabled.

Structs

This structure encapsulates the integer code for regions defined in the UN M49 standard.

Enums

Common Error type, mainly used for FromStr failures.
This enumeration is derived from the column headings in the M49 downloadable CSV file.

Constants

Provides an array of all defined RegionClassificationCode codes, useful for queries.
An instance of the Standard struct defined in the codes_agency package that describes the UN M49 specification.
South America
Western Africa
Central America
Eastern Africa
Northern Africa
American Samoa
Middle Africa
Southern Africa
Northern America
Antigua and Barbuda
Eastern Asia
Southern Asia
South-eastern Asia
Southern Europe
Australia and New Zealand
Bolivia (Plurinational State of)
Bosnia and Herzegovina
Bouvet Island
British Indian Ocean Territory
Solomon Islands
British Virgin Islands
Brunei Darussalam
Cayman Islands
Central African Republic
Central Asia
Western Asia
Eastern Europe
Northern Europe
Western Europe
Christmas Island
Cocos (Keeling) Islands
Democratic Republic of the Congo
Cook Islands
Sub-Saharan Africa
Dominican Republic
Equatorial Guinea
Faroe Islands
Falkland Islands (Malvinas)
South Georgia and the South Sandwich Islands
Åland Islands
French Guiana
French Polynesia
French Southern Territories
State of Palestine
Heard Island and McDonald Islands
China, Hong Kong Special Administrative Region
Iran (Islamic Republic of)
Côte d’Ivoire
Democratic People’s Republic of Korea
Republic of Korea
Lao People’s Democratic Republic
Latin America and the Caribbean
Liechtenstein
China, Macao Special Administrative Region
Republic of Moldova
Sint Maarten (Dutch part)
Bonaire, Sint Eustatius and Saba
New Caledonia
Norfolk Island
Northern Mariana Islands
United States Minor Outlying Islands
Micronesia (Federated States of)
Marshall Islands
Papua New Guinea
Guinea-Bissau
Russian Federation
Saint Barthélemy
Saint Helena
Saint Kitts and Nevis
Saint Martin (French Part)
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
Sao Tome and Principe
Saudi Arabia
Sierra Leone
South Africa
Western Sahara
Svalbard and Jan Mayen Islands
Syrian Arab Republic
Trinidad and Tobago
United Arab Emirates
Turkmenistan
Turks and Caicos Islands
North Macedonia
United Kingdom of Great Britain and Northern Ireland
Channel Islands
United Republic of Tanzania
United States of America
United States Virgin Islands
Burkina Faso
Venezuela (Bolivarian Republic of)
Wallis and Futuna Islands