Added id field.
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit

This commit is contained in:
Jeff Baskin 2024-11-08 22:41:07 -05:00
parent fc88177d75
commit e92a1a6d2b
2 changed files with 33 additions and 0 deletions

32
src/fields/mod.rs Normal file
View File

@ -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());
}
}

View File

@ -1,4 +1,5 @@
mod client; mod client;
mod fields;
mod message; mod message;
mod router; mod router;
mod session; mod session;