swiss_canton

Crates.ioswiss_canton
lib.rsswiss_canton
version0.1.0
sourcesrc
created_at2020-05-05 17:04:34.111482
updated_at2020-05-05 17:04:34.111482
descriptionEnum for Swiss-canton-specific behaviour
homepage
repositoryhttps://gitlab.com/tobias47n9e/swiss-canton-enum
max_upload_size
id237788
size12,030
Tobias Schönberg (tobias47n9e)

documentation

README

Swiss Canton Enum

Rust enum crate for Swiss-canton-specific code

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);
}
Commit count: 1

cargo fmt