summaryrefslogtreecommitdiff
path: root/core/src/net/session_token/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/net/session_token/mod.rs')
-rw-r--r--core/src/net/session_token/mod.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/net/session_token/mod.rs b/core/src/net/session_token/mod.rs
index cb3ab8c..0c839af 100644
--- a/core/src/net/session_token/mod.rs
+++ b/core/src/net/session_token/mod.rs
@@ -1,10 +1,21 @@
// Copyright 2022-2024 Gabriel Bjørnager Jensen.
use bzipper::{Deserialise, Serialise};
+use std::fmt::{Debug, Display, Formatter};
-#[derive(Debug, Deserialise, Serialise)]
+#[derive(Clone, Copy, Eq, Deserialise, PartialEq, Serialise)]
#[repr(align(0x10))]
pub struct SessionToken {
pub time: u64,
pub key: u64,
}
+
+impl Debug for SessionToken {
+ #[inline(always)]
+ fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { write!(f, "{self}") }
+}
+
+impl Display for SessionToken {
+ #[inline(always)]
+ fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { write!(f, "{:016X}:{:016X}", self.time, self.key) }
+}