diff --git a/src/fields/mod.rs b/src/fields/mod.rs new file mode 100644 index 0000000..fa25bde --- /dev/null +++ b/src/fields/mod.rs @@ -0,0 +1,32 @@ +use std::fmt; +use uuid::Uuid; + +struct ID { + data: Uuid, +} + +impl ID { + fn new(id: Uuid) -> Self { + Self { + data: id, + } + } +} + +impl fmt::Display for ID { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.data) + } +} + +#[cfg(test)] +mod id { + use super::*; + + #[test] + fn id_new() { + let data = Uuid::new_v4(); + let id = ID::new(data.clone()); + assert_eq!(id.to_string(), data.to_string()); + } +} diff --git a/src/lib.rs b/src/lib.rs index 915b039..86d1293 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ mod client; +mod fields; mod message; mod router; mod session;