Struct eu4save::CountryTag [−][src]
pub struct CountryTag(_);
Expand description
Wrapper around a Country’s unique three byte tag
use eu4save::CountryTag; let tag: CountryTag = "ENG".parse()?; assert_eq!(tag.to_string(), String::from("ENG"));
Implementations
impl CountryTag[src]
impl CountryTag[src]pub fn create<T: AsRef<[u8]>>(s: T) -> Result<Self, Eu4Error>[src]
pub fn create<T: AsRef<[u8]>>(s: T) -> Result<Self, Eu4Error>[src]Create a country tag from a byte slice. Returns error if input is not three bytes in length and not compose of dashes or alphanumeric data.
use eu4save::CountryTag; let tag: CountryTag = CountryTag::create(b"ENG")?;
pub fn is<T: AsRef<[u8]>>(&self, s: T) -> bool[src]
pub fn is<T: AsRef<[u8]>>(&self, s: T) -> bool[src]An ergonomic shortcut to determine if input byte slice contains the same data as the tag
use eu4save::CountryTag; let tag: CountryTag = CountryTag::create(b"ENG")?; assert!(tag.is(b"ENG"));
Trait Implementations
impl Clone for CountryTag[src]
impl Clone for CountryTag[src]fn clone(&self) -> CountryTag[src]
fn clone(&self) -> CountryTag[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl Debug for CountryTag[src]
impl Debug for CountryTag[src]impl<'de> Deserialize<'de> for CountryTag[src]
impl<'de> Deserialize<'de> for CountryTag[src]fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]Deserialize this value from the given Serde deserializer. Read more
impl Display for CountryTag[src]
impl Display for CountryTag[src]impl FromStr for CountryTag[src]
impl FromStr for CountryTag[src]impl Hash for CountryTag[src]
impl Hash for CountryTag[src]impl Ord for CountryTag[src]
impl Ord for CountryTag[src]impl PartialEq<CountryTag> for CountryTag[src]
impl PartialEq<CountryTag> for CountryTag[src]fn eq(&self, other: &CountryTag) -> bool[src]
fn eq(&self, other: &CountryTag) -> bool[src]This method tests for self and other values to be equal, and is used
by ==. Read more
fn ne(&self, other: &CountryTag) -> bool[src]
fn ne(&self, other: &CountryTag) -> bool[src]This method tests for !=.
impl PartialOrd<CountryTag> for CountryTag[src]
impl PartialOrd<CountryTag> for CountryTag[src]fn partial_cmp(&self, other: &CountryTag) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &CountryTag) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Serialize for CountryTag[src]
impl Serialize for CountryTag[src]impl Copy for CountryTag[src]
impl Eq for CountryTag[src]
impl StructuralEq for CountryTag[src]
impl StructuralPartialEq for CountryTag[src]
Auto Trait Implementations
impl RefUnwindSafe for CountryTag
impl Send for CountryTag
impl Sync for CountryTag
impl Unpin for CountryTag
impl UnwindSafe for CountryTag
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,