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
31
32
use std::fmt;
use serde_derive::{Serialize, Deserialize};
use uuid::Uuid;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct RbxId(Uuid);
#[allow(clippy::new_without_default)]
impl RbxId {
pub fn new() -> RbxId {
RbxId(Uuid::new_v4())
}
pub fn parse_str(input: &str) -> Option<RbxId> {
Uuid::parse_str(input).map(RbxId).ok()
}
}
impl fmt::Display for RbxId {
fn fmt(&self, writer: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(writer, "{}", self.0)
}
}