Struct eu4save::CountryTag [−][src]
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]
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]
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"));
pub fn as_bytes(&self) -> &[u8]
[src]
Returns the country tag as a byte slice
use eu4save::CountryTag; let tag: CountryTag = CountryTag::create(b"ENG")?; assert_eq!(tag.as_bytes(), b"ENG");
pub fn as_str(&self) -> &str
[src]
Returns the country tag as a string slice
use eu4save::CountryTag; let tag: CountryTag = CountryTag::create(b"ENG")?; assert_eq!(tag.as_str(), "ENG");
Trait Implementations
impl AsRef<str> for CountryTag
[src]
impl Clone for CountryTag
[src]
fn clone(&self) -> CountryTag
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for CountryTag
[src]
impl Debug for CountryTag
[src]
impl<'de> Deserialize<'de> for CountryTag
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for CountryTag
[src]
impl Eq for CountryTag
[src]
impl FromStr for CountryTag
[src]
type Err = Eu4Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for CountryTag
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for CountryTag
[src]
fn cmp(&self, other: &CountryTag) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<CountryTag> for CountryTag
[src]
fn eq(&self, other: &CountryTag) -> bool
[src]
fn ne(&self, other: &CountryTag) -> bool
[src]
impl PartialOrd<CountryTag> for CountryTag
[src]
fn partial_cmp(&self, other: &CountryTag) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,