Update lib.rs

+ added a module for each message string.
This commit is contained in:
michael bailey 2020-06-02 14:06:00 +01:00
parent 2e1d4d3b40
commit 30ab1655c9
1 changed files with 21 additions and 0 deletions

View File

@ -8,6 +8,27 @@ enum Message {
Terminate,
}
pub mod protocol_messages {
pub const REQUEST: &'static str = "?request:";
pub const INFO: &'static str = "?info!";
// results
pub const SUCCESS: &'static str = "!success:";
pub const ERROR: &'static str = "!error:";
// connect commands
pub const CONNECT: &'static str = "!connect:";
pub const DISCONNECT: &'static str = "!disconnect:";
// server commands
pub const UPDATE_CLIENTS: &'static str = "!clientUpdate:";
pub const CLIENT: &'static str = "!client:";
pub const TEST: &'static str = "!test:";
// ptp commands
pub const MESSAGE: &'static str = "!message:";
}
pub struct ThreadPool{
workers: Vec<Worker>,
sender: mpsc::Sender<Message>,