1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use super::Uuid;

impl From<Uuid> for uuid::Uuid {
    #[inline]
    fn from(uuid: Uuid) -> Self {
        uuid::Uuid::from_bytes(uuid.bytes)
    }
}

impl From<uuid::Uuid> for Uuid {
    #[inline]
    fn from(uuid: uuid::Uuid) -> Self {
        Self {
            bytes: *uuid.as_bytes(),
        }
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn test_uuid() {
        let uuid = uuid::Uuid::new_v4();

        let uuid_datatype: super::Uuid = uuid.into();

        let uuid_roundtrip: uuid::Uuid = uuid_datatype.into();
        assert_eq!(uuid, uuid_roundtrip);
    }
}