[−][src]Enum swiss_canton::SwissCanton
Swiss Canton Enum
If your code has to do canton-specific things you can use this enum.
Example
You can use the enum to control something in your code:
use swiss_canton::SwissCanton; let canton = SwissCanton::ZH; match canton { SwissCanton::ZH => println!("Salü!"), SwissCanton::NE => println!("Bonjour !"), _ => println!("Grüezi!") }
You can also parse, compare and print the short code of the canton:
use swiss_canton::SwissCanton; let parsed_canton = "TI".parse::<SwissCanton>().unwrap(); if (parsed_canton.eq(&SwissCanton::TI)) { println!("Buongiorno in {}!", SwissCanton::TI); }
Variants
Trait Implementations
impl Debug for SwissCanton
[src]
impl Display for SwissCanton
[src]
impl FromStr for SwissCanton
[src]
type Err = SwissCantonError
The associated error which can be returned from parsing.
fn from_str(canton_short_code: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<SwissCanton> for SwissCanton
[src]
fn eq(&self, other: &SwissCanton) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralPartialEq for SwissCanton
[src]
Auto Trait Implementations
impl RefUnwindSafe for SwissCanton
impl Send for SwissCanton
impl Sync for SwissCanton
impl Unpin for SwissCanton
impl UnwindSafe for SwissCanton
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,