summaryrefslogblamecommitdiff
path: root/core/src/net/session_token/mod.rs
blob: 0c839affb6bce3311652ef6e5c0ee0fc52f4b5c4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11


                                                 
                                          
 
                                                             




                         









                                                                                                                  
// 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) }
}