summary refs log tree commit diff
path: root/crates/messenger_common/src/client.rs
diff options
context:
space:
mode:
authorSophie Forrest <git@sophieforrest.com>2024-08-30 23:13:20 +1200
committerSophie Forrest <git@sophieforrest.com>2024-08-30 23:13:44 +1200
commite3cb82a3b33bd2a2e49c58ce18d1258fb505869e (patch)
tree2375279182fb4f90f5c28560a08cda90591f608b /crates/messenger_common/src/client.rs
chore: initial commit (codeberg upload) HEAD main
Diffstat (limited to 'crates/messenger_common/src/client.rs')
-rw-r--r--crates/messenger_common/src/client.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/messenger_common/src/client.rs b/crates/messenger_common/src/client.rs
new file mode 100644
index 0000000..69a7fd6
--- /dev/null
+++ b/crates/messenger_common/src/client.rs
@@ -0,0 +1,15 @@
+//! Messages sent from the client to the server by the messenger.
+
+use serde::{Deserialize, Serialize};
+
+/// Represents the type of message being sent between the client and the server
+#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub enum MessageType {
+	/// Sent when a user joins the chat. Contains the username they wish to pick
+	SetUsername(String),
+
+	/// Sent when a user sends a message in the chat. Contains their message as
+	/// a string
+	UserMessage(String),
+}