diff options
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(), + }; +} |