1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use serde::{Deserialize, Serialize};

#[repr(u8)]
#[derive(Serialize, Deserialize, Debug)]
pub enum MessageType {
    Join,
    Remove,
    Gossip,
    Sync,
    Ping,
    Heartbeat,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Message<'a> {
    pub target: &'a str,
    pub sender: &'a str,
    pub msg_type: MessageType,
    pub payload: Vec<String>, // Maybe change to something more JSON friendly
}