1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#[macro_use]
extern crate serde_derive;
extern crate uuid;
use uuid::Uuid;
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub struct SessionKey(pub Uuid);
impl SessionKey {
pub fn new() -> Self {
SessionKey(Uuid::new_v4())
}
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub struct ConnectionKey(pub u32);
#[derive(Clone, Debug)]
pub struct CallbackDataAndSession<T> {
pub payload: T,
pub session_key: SessionKey,
}