| Crates.io | swiss_uid |
| lib.rs | swiss_uid |
| version | 1.1.1 |
| created_at | 2024-01-22 23:23:54.645308+00 |
| updated_at | 2025-04-26 19:00:37.229868+00 |
| description | A Rust implementation of the Swiss UID number based on the Swiss E-Government Standard eCH-0098:2021 |
| homepage | https://github.com/qbasic16/swiss_uid/ |
| repository | https://github.com/qbasic16/swiss_uid/ |
| max_upload_size | |
| id | 1109636 |
| size | 21,177 |
This library implements functionalities and data structures in accordance to the data standard eCH-0098:2021 5.2.0
use swiss_uid::uid::SwissUid;
// Using the new function:
let uid = SwissUid::new("CHE-109.322.551").unwrap();
assert_eq!(format!("{:?}", uid), "CHE-109.322.55[1]".to_owned()); // Debug output
assert_eq!(format!("{}", uid), "CHE-109.322.551".to_owned()); // Display output
assert_eq!(uid.to_string(), "CHE-109.322.551".to_owned()); // Display output
assert_eq!(uid.to_string_mwst(), "CHE-109.322.551 MWST".to_owned());
assert_eq!(uid.to_string_hr(), "CHE-109.322.551 HR".to_owned());
// Parse a string directly:
let uid2: SwissUid = "CHE-109.322.551".parse().unwrap();
assert_eq!(uid2.to_string().len(), 15);