diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-03-14 15:39:00 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-03-14 15:39:00 +0100 |
commit | bf6c4bd75168671a5a0e53f7390ebd4796a6bd57 (patch) | |
tree | 0e41323722317500f24d9504478b461a71fee453 /src/helpers.rs | |
parent | 6afd0e59f62889d44b90193f0d8581668eae9c28 (diff) |
chore: add helpers module
Diffstat (limited to 'src/helpers.rs')
-rw-r--r-- | src/helpers.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/helpers.rs b/src/helpers.rs new file mode 100644 index 0000000..d915a50 --- /dev/null +++ b/src/helpers.rs @@ -0,0 +1,9 @@ +use uuid::Uuid; + +/// Returns a valid Uuid if `id` is not a valid Uuid +pub fn uuid_from_string(id: &String) -> Uuid { + return match Uuid::parse_str(&id) { + Ok(x) => x, + Err(_) => Uuid::parse_str("00000000000000000000000000000000").unwrap(), + }; +} |