Enum keshvar::SubRegion

source ·
pub enum SubRegion {
Show 22 variants AustraliaAndNewZealand, Caribbean, CentralAmerica, CentralAsia, EasternAfrica, EasternAsia, EasternEurope, Melanesia, Micronesia, MiddleAfrica, NorthernAfrica, NorthernAmerica, NorthernEurope, Polynesia, SouthAmerica, SouthEasternAsia, SouthernAfrica, SouthernAsia, SouthernEurope, WesternAfrica, WesternAsia, WesternEurope,
}
Expand description

An enum containing sub-regions.

§Example

use keshvar::{SubRegion, Alpha2};

let sub_region = SubRegion::try_from("northern-america").unwrap();
let country_list: Vec<_> = sub_region
    .alpha2_list()
    .iter()
    .map(|alpha2_str| Alpha2::try_from(*alpha2_str).unwrap())
    .collect();
assert!(country_list.contains(&Alpha2::CA)); // Canada

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

Variants§

§

AustraliaAndNewZealand

  • The Commonwealth of Australia
  • The Territory of Cocos (Keeling) Islands
  • The Territory of Christmas Island
  • The Territory of Norfolk Island
  • New Zealand
§

Caribbean

  • Antigua and Barbuda
  • Anguilla
  • Aruba
  • Barbados
  • The Collectivity of Saint-Barthélemy
  • Bonaire, Sint Eustatius and Saba
  • The Commonwealth of The Bahamas
  • The Republic of Cuba
  • The Country of Curaçao
  • The Commonwealth of Dominica
  • The Dominican Republic
  • Grenada
  • Guadeloupe
  • The Republic of Haiti
  • Jamaica
  • Saint Kitts and Nevis
  • The Cayman Islands
  • Saint Lucia
  • The Collectivity of Saint-Martin
  • Martinique
  • Montserrat
  • The Commonwealth of Puerto Rico
  • Sint Maarten
  • The Turks and Caicos Islands
  • The Republic of Trinidad and Tobago
  • Saint Vincent and the Grenadines
  • The Virgin Islands
  • The Virgin Islands of the United States
§

CentralAmerica

  • Belize
  • The Republic of Costa Rica
  • The Republic of Guatemala
  • The Republic of Honduras
  • The United Mexican States
  • The Republic of Nicaragua
  • The Republic of Panamá
  • The Republic of El Salvador
§

CentralAsia

  • The Kyrgyz Republic
  • The Republic of Kazakhstan
  • The Republic of Tajikistan
  • Turkmenistan
  • The Republic of Uzbekistan
§

EasternAfrica

  • The Republic of Burundi
  • The Republic of Djibouti
  • The State of Eritrea
  • The Federal Democratic Republic of Ethiopia
  • The British Indian Ocean Territory
  • The Republic of Kenya
  • The Union of the Comoros
  • The Republic of Madagascar
  • The Republic of Mauritius
  • The Republic of Malawi
  • The Republic of Mozambique
  • Réunion
  • The Republic of Rwanda
  • The Republic of Seychelles
  • The Federal Republic of Somalia
  • The French Southern and Antarctic Lands
  • The United Republic of Tanzania
  • The Republic of Uganda
  • The Department of Mayotte
  • The Republic of Zambia
  • The Republic of Zimbabwe
§

EasternAsia

  • The People’s Republic of China
  • The Hong Kong Special Administrative Region of China
  • Japan
  • The Democratic People’s Republic of Korea
  • The Republic of Korea
  • Mongolia
  • The Macao Special Administrative Region of China
  • Taiwan, Province of China
§

EasternEurope

  • The Republic of Bulgaria
  • The Republic of Belarus
  • The Czech Republic
  • Hungary
  • The Republic of Moldova
  • The Republic of Poland
  • Romania
  • The Russian Federation
  • The Slovak Republic
  • Ukraine
§

Melanesia

  • The Republic of Fiji
  • New Caledonia
  • The Independent State of Papua New Guinea
  • The Solomon Islands
  • The Republic of Vanuatu
§

Micronesia

  • The Federated States of Micronesia
  • The Territory of Guam
  • The Republic of Kiribati
  • The Republic of the Marshall Islands
  • The Commonwealth of the Northern Mariana Islands
  • The Republic of Nauru
  • The Republic of Palau
§

MiddleAfrica

  • The Republic of Angola
  • The Democratic Republic of the Congo
  • The Central African Republic
  • The Republic of the Congo
  • The Republic of Cameroon
  • The Gabonese Republic
  • The Republic of Equatorial Guinea
  • The Democratic Republic of São Tomé and Príncipe
  • The Republic of Chad
§

NorthernAfrica

  • The People’s Democratic Republic of Algeria
  • The Arab Republic of Egypt
  • The Sahrawi Arab Democratic Republic
  • The State of Libya
  • The Kingdom of Morocco
  • The Republic of the Sudan
  • The Republic of South Sudan
  • The Republic of Tunisia
§

NorthernAmerica

  • Bermuda
  • Canada
  • Kalaallit Nunaat
  • The Overseas Collectivity of Saint-Pierre and Miquelon
  • United States Minor Outlying Islands
  • The United States of America
§

NorthernEurope

  • Åland
  • The Kingdom of Denmark
  • The Republic of Estonia
  • The Republic of Finland
  • The Faroe Islands
  • The United Kingdom of Great Britain and Northern Ireland
  • The Bailiwick of Guernsey
  • Ireland
  • The Isle of Man
  • Iceland
  • The Bailiwick of Jersey
  • The Republic of Lithuania
  • The Republic of Latvia
  • The Kingdom of Norway
  • The Kingdom of Sweden
  • Svalbard and Jan Mayen
§

Polynesia

  • The Territory of American Samoa
  • The Cook Islands
  • Niue
  • French Polynesia
  • The Pitcairn, Henderson, Ducie and Oeno Islands
  • Tokelau
  • The Kingdom of Tonga
  • Tuvalu
  • The Territory of the Wallis and Futuna Islands
  • The Independent State of Samoa
§

SouthAmerica

  • The Argentine Republic
  • The Plurinational State of Bolivia
  • The Federative Republic of Brazil
  • The Republic of Chile
  • The Republic of Colombia
  • The Republic of Ecuador
  • The Falkland Islands
  • Guyane
  • South Georgia and the South Sandwich Islands
  • The Co-operative Republic of Guyana
  • The Republic of Perú
  • The Republic of Paraguay
  • The Republic of Suriname
  • The Oriental Republic of Uruguay
  • The Bolivarian Republic of Venezuela
§

SouthEasternAsia

  • The Nation of Brunei, the Abode of Peace
  • The Republic of Indonesia
  • The Kingdom of Cambodia
  • The Lao People’s Democratic Republic
  • The Republic of the Union of Myanmar
  • Malaysia
  • The Republic of the Philippines
  • The Republic of Singapore
  • The Kingdom of Thailand
  • The Democratic Republic of Timor-Leste
  • The Socialist Republic of Viet Nam
§

SouthernAfrica

  • The Republic of Botswana
  • The Kingdom of Lesotho
  • The Republic of Namibia
  • The Kingdom of Eswatini
  • The Republic of South Africa
§

SouthernAsia

  • The Islamic Republic of Afghanistan
  • The People’s Republic of Bangladesh
  • The Kingdom of Bhutan
  • The Republic of India
  • The Islamic Republic of Iran
  • The Democratic Socialist Republic of Sri Lanka
  • The Republic of Maldives
  • The Federal Democratic Republic of Nepal
  • The Islamic Republic of Pakistan
§

SouthernEurope

  • The Principality of Andorra
  • The Republic of Albania
  • Bosnia and Herzegovina
  • The Kingdom of Spain
  • Gibraltar
  • The Hellenic Republic
  • The Republic of Croatia
  • The Italian Republic
  • Montenegro
  • The Republic of North Macedonia
  • The Republic of Malta
  • The Portuguese Republic
  • The Republic of Serbia
  • The Republic of Slovenia
  • The Republic of San Marino
  • The Holy See
§

WesternAfrica

  • Burkina Faso
  • The Republic of Benin
  • The Republic of Côte d’Ivoire
  • The Republic of Cabo Verde
  • The Republic of Ghana
  • The Republic of The Gambia
  • The Republic of Guinea
  • The Republic of Guinea-Bissau
  • The Republic of Liberia
  • The Republic of Mali
  • The Islamic Republic of Mauritania
  • The Republic of the Niger
  • The Federal Republic of Nigeria
  • Saint Helena, Ascension and Tristan da Cunha
  • The Republic of Sierra Leone
  • The Republic of Senegal
  • The Togolese Republic
§

WesternAsia

  • The United Arab Emirates
  • The Republic of Armenia
  • The Republic of Azerbaijan
  • The Kingdom of Bahrain
  • The Republic of Cyprus
  • Georgia
  • The State of Israel
  • The Republic of Iraq
  • The Hashemite Kingdom of Jordan
  • The State of Kuwait
  • The Lebanese Republic
  • The Sultanate of Oman
  • The State of Palestine
  • The State of Qatar
  • The Kingdom of Saudi Arabia
  • The Syrian Arab Republic
  • The Republic of Türkiye
  • The Republic of Yemen
§

WesternEurope

  • The Republic of Austria
  • The Kingdom of Belgium
  • The Swiss Confederation
  • The Federal Republic of Germany
  • The French Republic
  • The Principality of Liechtenstein
  • The Grand Duchy of Luxembourg
  • The Principality of Monaco
  • The Kingdom of the Netherlands

Implementations§

source§

impl SubRegion

source

pub fn alpha2_list(&self) -> &[&str]

You can try converting each item to Alpha2 and if you did not include some country features the conversion will fail.

Trait Implementations§

source§

impl Clone for SubRegion

source§

fn clone(&self) -> SubRegion

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 SubRegion

source§

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

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

impl<'de> Deserialize<'de> for SubRegion

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 PartialEq for SubRegion

source§

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

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 SubRegion

source§

fn to_string(&self) -> String

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

impl TryFrom<&str> for SubRegion

§

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 SubRegion

source§

impl StructuralPartialEq for SubRegion

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>,