summaryrefslogtreecommitdiff
path: root/src/helpers.rs
blob: d915a50e06fa9989772ba428dd7dfa8c0bb18b29 (plain)
1
2
3
4
5
6
7
8
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(),
    };
}