pub struct Country {
pub name: String,
pub phone_code: String,
pub iso_2_code: String,
pub iso_3_code: String,
}
Fields§
§name: String
§phone_code: String
§iso_2_code: String
§iso_3_code: String
Implementations§
Source§impl Country
impl Country
Sourcepub fn new(
name: String,
phone_code: String,
iso_2_code: String,
iso_3_code: String,
) -> Self
pub fn new( name: String, phone_code: String, iso_2_code: String, iso_3_code: String, ) -> Self
This is the constructor function.
#Example
extern crate scaffolding_core;
use scaffolding_core::Country;
fn main() {
let country = Country::new("United States".to_string(), "1".to_string(), "US".to_string(), "USA".to_string());
assert_eq!(country.name, "United States".to_string());
assert_eq!(country.phone_code, "1".to_string());
assert_eq!(country.iso_2_code, "US".to_string());
assert_eq!(country.iso_3_code, "USA".to_string());
}
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Country
impl<'de> Deserialize<'de> for Country
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Country
impl RefUnwindSafe for Country
impl Send for Country
impl Sync for Country
impl Unpin for Country
impl UnwindSafe for Country
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more