aboutsummaryrefslogtreecommitdiff
path: root/src/wire/update.rs
blob: 27f2d0ddded310ccaefa05fe80e751a60496b279 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Update to the game state

use super::UserId;
use serde::{Deserialize, Serialize};

/// An update provided by the game server
#[derive(Serialize, Deserialize)]
pub enum Update {
    /// Update made to a node
    Node(NodeUpdate),
    /// Update made to a link
    Link(LinkUpdate),
    /// Update made to a packet
    Packet(PacketUpdate),
    /// Update made to the user set
    User(UserUpdate),
    /// An error occured, can be non-fatal
    Error(UpdateError),
}

/// Update made to a node
#[derive(Serialize, Deserialize)]
pub enum NodeUpdate {}

/// Update made to a link
#[derive(Serialize, Deserialize)]
pub enum LinkUpdate {}

/// Update made to a packet
#[derive(Serialize, Deserialize)]
pub enum PacketUpdate {}

/// Update made to the user set
#[derive(Serialize, Deserialize)]
pub enum UserUpdate {
    UserLeft(UserId),
}

/// An error occured, can be non-fatal
#[derive(Serialize, Deserialize)]
pub enum UpdateError {
    /// You are the last user in the match
    LastUser,
}