aboutsummaryrefslogtreecommitdiff
path: root/src/message.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/message.rs')
-rw-r--r--src/message.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/message.rs b/src/message.rs
new file mode 100644
index 0000000..bcc5aac
--- /dev/null
+++ b/src/message.rs
@@ -0,0 +1,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 = ();
+}