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
impl From<re_protos::common::v0::Tuid> for crate::Tuid {
    fn from(value: re_protos::common::v0::Tuid) -> Self {
        Self {
            time_ns: value.time_ns,
            inc: value.inc,
        }
    }
}

impl From<crate::Tuid> for re_protos::common::v0::Tuid {
    fn from(value: crate::Tuid) -> Self {
        Self {
            time_ns: value.time_ns,
            inc: value.inc,
        }
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn test_tuid_conversion() {
        let tuid = crate::Tuid::new();
        let proto_tuid: re_protos::common::v0::Tuid = tuid.into();
        let tuid2: crate::Tuid = proto_tuid.into();
        assert_eq!(tuid, tuid2);
    }
}