gameServer2/src/protocol/messages.rs
changeset 12138 81df2e1f9ae9
parent 12136 a4d22f197bd2
child 12140 23ee939ba66a
--- a/gameServer2/src/protocol/messages.rs	Sat Jan 07 21:34:00 2017 +0300
+++ b/gameServer2/src/protocol/messages.rs	Sun Jan 08 23:57:45 2017 +0300
@@ -4,67 +4,67 @@
 use std::convert::From;
 
 #[derive(PartialEq, Debug)]
-pub enum HWProtocolMessage {
+pub enum HWProtocolMessage<'a> {
     // core
     Ping,
     Pong,
-    Quit(Option<String>),
-    //Cmd(String, Vec<String>),
-    Global(String),
-    Watch(String),
+    Quit(Option<&'a str>),
+    //Cmd(&'a str, Vec<&'a str>),
+    Global(&'a str),
+    Watch(&'a str),
     ToggleServerRegisteredOnly,
     SuperPower,
-    Info(String),
+    Info(&'a str),
     // not entered state
-    Nick(String),
+    Nick(&'a str),
     Proto(u32),
-    Password(String, String),
-    Checker(String),
+    Password(&'a str, &'a str),
+    Checker(&'a str),
     // lobby
     List,
-    Chat(String),
-    CreateRoom(String, Option<String>),
-    Join(String, Option<String>),
-    Follow(String),
-    Rnd(Vec<String>),
-    Kick(String),
-    Ban(String, String, u32),
-    BanIP(String, String, u32),
-    BanNick(String, String, u32),
+    Chat(&'a str),
+    CreateRoom(&'a str, Option<&'a str>),
+    Join(&'a str, Option<&'a str>),
+    Follow(&'a str),
+    Rnd(Vec<&'a str>),
+    Kick(&'a str),
+    Ban(&'a str, &'a str, u32),
+    BanIP(&'a str, &'a str, u32),
+    BanNick(&'a str, &'a str, u32),
     BanList,
-    Unban(String),
+    Unban(&'a str),
     SetServerVar(ServerVar),
     GetServerVar,
     RestartServer,
     Stats,
     // in room
-    Part(Option<String>),
+    Part(Option<&'a str>),
     Cfg(GameCfg),
     AddTeam(TeamInfo),
-    RemoveTeam(String),
-    SetHedgehogsNumber(String, u8),
-    SetTeamColor(String, u8),
+    RemoveTeam(&'a str),
+    SetHedgehogsNumber(&'a str, u8),
+    SetTeamColor(&'a str, u8),
     ToggleReady,
     StartGame,
-    EngineMessage,
+    EngineMessage(&'a str),
     RoundFinished,
     ToggleRestrictJoin,
     ToggleRestrictTeams,
     ToggleRegisteredOnly,
-    RoomName(String),
-    Delegate(String),
-    TeamChat(String),
+    RoomName(&'a str),
+    Delegate(&'a str),
+    TeamChat(&'a str),
     MaxTeams(u8),
     Fix,
     Unfix,
-    Greeting(String),
-    CallVote(Option<(String, Option<String>)>),
-    Vote(String),
-    ForceVote(String),
-    Save(String, String),
-    Delete(String, String),
-    SaveRoom(String),
-    LoadRoom(String),
+    Greeting(&'a str),
+    CallVote(Option<(&'a str, Option<&'a str>)>),
+    Vote(&'a str),
+    ForceVote(&'a str),
+    Save(&'a str, &'a str),
+    Delete(&'a str, &'a str),
+    SaveRoom(&'a str),
+    LoadRoom(&'a str),
 }
 
 pub fn number<T: From<u8>