Skip to main content

datex_core/utils/
uuid.rs

1use datex_crypto_facade::crypto::Crypto;
2
3use crate::prelude::*;
4use core::fmt::Display;
5
6use crate::crypto::CryptoImpl;
7#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8pub struct UUID(String);
9
10impl UUID {
11    pub(crate) fn new() -> UUID {
12        UUID(CryptoImpl::create_uuid())
13    }
14    pub fn from_string(uuid: String) -> UUID {
15        UUID(uuid)
16    }
17}
18
19impl Display for UUID {
20    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
21        core::write!(f, "{}", self.0)
22    }
23}