Country

Struct Country 

Source
pub struct Country {
Show 29 fields pub iso_code: &'static str, pub alpha3: &'static str, pub continent: &'static str, pub continent_code: &'static str, pub country_code: &'static str, pub currency_code: &'static str, pub distance_unit: &'static str, pub economic_unions: &'static [&'static str], pub gec: &'static str, pub geo: Geo, pub international_prefix: &'static str, pub ioc: &'static str, pub iso_long_name: &'static str, pub iso_short_name: &'static str, pub languages_official: &'static [&'static str], pub languages_spoken: &'static [&'static str], pub national_destination_code_lengths: &'static [u8], pub national_number_lengths: &'static [u8], pub national_prefix: Option<&'static str>, pub nationality: &'static str, pub number: &'static str, pub postal_code: bool, pub postal_code_format: &'static str, pub region: &'static str, pub start_of_week: &'static str, pub subregion: &'static str, pub un_locode: &'static str, pub unofficial_names: &'static [&'static str], pub world_region: &'static str,
}
Expand description

Country information.

Fields§

§iso_code: &'static str

The ISO 3166-1 alpha-2 code of the country.

§alpha3: &'static str

The ISO 3166-1 alpha-3 code of the country.

§continent: &'static str

The continent the country is located in.

§continent_code: &'static str

The continent code.

§country_code: &'static str

The country code.

§currency_code: &'static str

The currency code used in the country.

§distance_unit: &'static str

The distance unit used in the country.

§economic_unions: &'static [&'static str]

The economic unions the country is part of.

§gec: &'static str

The GEC (Geographic Encoding Class) code.

§geo: Geo

The geographic information.

§international_prefix: &'static str

The international dialing prefix.

§ioc: &'static str

The IOC (International Olympic Committee) code.

§iso_long_name: &'static str

The long name of the country in ISO format.

§iso_short_name: &'static str

The short name of the country in ISO format.

§languages_official: &'static [&'static str]

The official languages of the country.

§languages_spoken: &'static [&'static str]

The spoken languages in the country.

§national_destination_code_lengths: &'static [u8]

The national destination code lengths.

§national_number_lengths: &'static [u8]

The national number lengths.

§national_prefix: Option<&'static str>

The national prefix.

§nationality: &'static str

The nationality.

§number: &'static str

The country number.

§postal_code: bool

Whether the country has a postal code.

§postal_code_format: &'static str

The postal code format.

§region: &'static str

The region the country is located in.

§start_of_week: &'static str

The start of the week in the country.

§subregion: &'static str

The subregion the country is located in.

§un_locode: &'static str

The UN/LOCODE of the country.

§unofficial_names: &'static [&'static str]

The unofficial names of the country.

§world_region: &'static str

The world region the country is located in.

Implementations§

Source§

impl Country

Source

pub fn is_language_official(&self, language: &str) -> bool

Checks if a language is an official language of the country.

Source

pub fn is_language_spoken(&self, language: &str) -> bool

Checks if a language is a spoken language of the country.

Source

pub fn has_language(&self, language: &str) -> bool

Checks if a language is either an official or spoken language of the country.

Source

pub fn is_unofficial_name(&self, name: &str) -> bool

Checks if a name is an unofficial name of the country.

Source

pub fn has_unofficial_name(&self, name: &str) -> bool

Checks if a name is either the short name or an unofficial name of the country.

Source

pub fn is_region(&self, region: &str) -> bool

Checks if a region is the region the country is located in.

Source

pub fn is_subregion(&self, subregion: &str) -> bool

Checks if a subregion is the subregion the country is located in.

Source

pub fn is_region_or_subregion(&self, region_or_subregion: &str) -> bool

Checks if a region is either the region or subregion the country is located in.

Source

pub fn is_region_or_subregion_case_insensitive( &self, region_or_subregion: &str, ) -> bool

Checks if a region is either the region or subregion the country is located in.

Source

pub fn is_in_economic_union(&self, economic_union: &str) -> bool

Checks if the country is part of a specific economic union.

Source

pub fn is_in_economic_union_case_insensitive( &self, economic_union: &str, ) -> bool

Checks if the country is part of a specific economic union.

Trait Implementations§

Source§

impl Clone for Country

Source§

fn clone(&self) -> Country

Returns a duplicate 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 Country

Source§

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

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

impl PartialEq for Country

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Country

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 StructuralPartialEq for Country

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

Source§

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

Source§

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.