aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-03 19:47:19 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-03 19:47:19 +0100
commita46b4984992ecdf675bb0ad4ab568d79ab2a5ce4 (patch)
tree367b6a94300ef908f2d114c388b77f401ee44c9b
parent6d8d043d93cc4ede432d4082670ea7f92d3cade2 (diff)
[example:chat] Move chat demo files into a chat directory
-rw-r--r--Cargo.toml8
-rw-r--r--examples/chat/client.rs (renamed from examples/terminal_chat_client/main.rs)6
-rw-r--r--examples/chat/protocol.rs (renamed from examples/chat_protocol/lib.rs)0
-rw-r--r--examples/chat/server.rs (renamed from examples/chat_server/main.rs)5
4 files changed, 13 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f351a09..648e2ca 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,3 +31,11 @@ rand = "0.8.5"
[[example]]
name = "breakout"
path = "examples/breakout/breakout.rs"
+
+[[example]]
+name = "chat-server"
+path = "examples/chat/server.rs"
+
+[[example]]
+name = "chat-client"
+path = "examples/chat/client.rs"
diff --git a/examples/terminal_chat_client/main.rs b/examples/chat/client.rs
index 998fcd4..b0f330d 100644
--- a/examples/terminal_chat_client/main.rs
+++ b/examples/chat/client.rs
@@ -16,12 +16,12 @@ use bevy_quinnet::{
},
ClientId,
};
-use chat_protocol::{ClientMessage, ServerMessage};
use rand::{distributions::Alphanumeric, Rng};
use tokio::sync::mpsc;
-#[path = "../chat_protocol/lib.rs"] // Because we can't have a shared lib between Cargo examples
-mod chat_protocol;
+use protocol::{ClientMessage, ServerMessage};
+
+mod protocol;
#[derive(Debug, Clone, Default)]
struct Users {
diff --git a/examples/chat_protocol/lib.rs b/examples/chat/protocol.rs
index 6a51e50..6a51e50 100644
--- a/examples/chat_protocol/lib.rs
+++ b/examples/chat/protocol.rs
diff --git a/examples/chat_server/main.rs b/examples/chat/server.rs
index df953b0..26fa75e 100644
--- a/examples/chat_server/main.rs
+++ b/examples/chat/server.rs
@@ -9,10 +9,9 @@ use bevy_quinnet::{
ClientId,
};
-use chat_protocol::{ClientMessage, ServerMessage};
+use protocol::{ClientMessage, ServerMessage};
-#[path = "../chat_protocol/lib.rs"] // Because we can't have a shared lib between Cargo examples
-mod chat_protocol;
+mod protocol;
#[derive(Debug, Clone, Default)]
struct Users {