Struct rust_iso3166::CountryCode
source · [−]pub struct CountryCode {
pub name: &'static str,
pub alpha2: &'static str,
pub alpha3: &'static str,
pub numeric: i32,
}
Expand description
Sample code
let country = rust_iso3166::from_alpha2("AU");
assert_eq!("AUS", country.unwrap().alpha3);
let country = rust_iso3166::from_alpha3("AUS");
assert_eq!("AU", country.unwrap().alpha2);
let country = rust_iso3166::from_numeric(036);
assert_eq!("AUS", country.unwrap().alpha3);
let country = rust_iso3166::from_numeric_str("036");
assert_eq!("AUS", country.unwrap().alpha3);
println!("{:?}", country);
println!("{:?}", rust_iso3166::ALL);
println!("{:?}", rust_iso3166::ALL_ALPHA2);
println!("{:?}", rust_iso3166::ALL_ALPHA3);
println!("{:?}", rust_iso3166::ALL_NAME);
println!("{:?}", rust_iso3166::ALL_NUMERIC);
println!("{:?}", rust_iso3166::ALL_NUMERIC_STR);
println!("{:?}", rust_iso3166::NUMERIC_MAP);
println!("{:?}", rust_iso3166::ALPHA3_MAP);
println!("{:?}", rust_iso3166::ALPHA2_MAP);
Data for each Country Code defined by ISO 3166-1
Fields
name: &'static str
English short name
alpha2: &'static str
Alpha-2 code
alpha3: &'static str
Alpha-3 code
numeric: i32
Numeric code
Implementations
sourceimpl CountryCode
impl CountryCode
sourcepub fn numeric_str(&self) -> String
pub fn numeric_str(&self) -> String
Return len 3 String for CountryCode numeric
Trait Implementations
sourceimpl Clone for CountryCode
impl Clone for CountryCode
sourcefn clone(&self) -> CountryCode
fn clone(&self) -> CountryCode
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CountryCode
impl Debug for CountryCode
impl Copy for CountryCode
Auto Trait Implementations
impl RefUnwindSafe for CountryCode
impl Send for CountryCode
impl Sync for CountryCode
impl Unpin for CountryCode
impl UnwindSafe for CountryCode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more