summaryrefslogtreecommitdiff
path: root/core/src/net/session_token/mod.rs
blob: 0c839affb6bce3311652ef6e5c0ee0fc52f4b5c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2022-2024 Gabriel Bjørnager Jensen.

use bzipper::{Deserialise, Serialise};
use std::fmt::{Debug, Display, Formatter};

#[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) }
}