aboutsummaryrefslogblamecommitdiff
path: root/src/message.rs
blob: bcc5aac9eb7156c203690f649400a938b4f5839d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                           
use serde::{Deserialize, Serialize};

pub type MessageKind = u32;

pub trait Message: Serialize + for<'de> Deserialize<'de> + Send + Sync {
	const KIND: MessageKind;
	type Response: Serialize + for<'de> Deserialize<'de> + Send + Sync;
}

#[derive(Serialize, Deserialize)]
pub(crate) struct HelloMessage {
	pub server_port: u16,
}

impl Message for HelloMessage {
	const KIND: MessageKind = 0x42000001;
	type Response = ();
}