gameServer2/src/protocol/test.rs
changeset 13433 fb104e150878
parent 13432 ee3fa3b8809d
child 13437 a0c3431f60ac
equal deleted inserted replaced
13432:ee3fa3b8809d 13433:fb104e150878
    10 };
    10 };
    11 
    11 
    12 // Due to inability to define From between Options
    12 // Due to inability to define From between Options
    13 trait Into2<T>: Sized { fn into2(self) -> T; }
    13 trait Into2<T>: Sized { fn into2(self) -> T; }
    14 impl <T> Into2<T> for T { fn into2(self) -> T { self } }
    14 impl <T> Into2<T> for T { fn into2(self) -> T { self } }
       
    15 impl Into2<Vec<String>> for Vec<Ascii> {
       
    16     fn into2(self) -> Vec<String> {
       
    17         self.into_iter().map(|x| x.0).collect()
       
    18     }
       
    19 }
    15 impl Into2<String> for Ascii { fn into2(self) -> String { self.0 } }
    20 impl Into2<String> for Ascii { fn into2(self) -> String { self.0 } }
    16 impl Into2<Option<String>> for Option<Ascii>{
    21 impl Into2<Option<String>> for Option<Ascii>{
    17     fn into2(self) -> Option<String> { self.map(|x| {x.0}) }
    22     fn into2(self) -> Option<String> { self.map(|x| {x.0}) }
    18 }
    23 }
    19 
    24 
    88         13 => List(),
    93         13 => List(),
    89         14 => Chat(Ascii),
    94         14 => Chat(Ascii),
    90         15 => CreateRoom(Ascii, Option<Ascii>),
    95         15 => CreateRoom(Ascii, Option<Ascii>),
    91         16 => JoinRoom(Ascii, Option<Ascii>),
    96         16 => JoinRoom(Ascii, Option<Ascii>),
    92         17 => Follow(Ascii),
    97         17 => Follow(Ascii),
    93         //18 => Rnd(Vec<String>),
    98         18 => Rnd(Vec<Ascii>),
    94         19 => Kick(Ascii),
    99         19 => Kick(Ascii),
    95         20 => Ban(Ascii, Ascii, u32),
   100         20 => Ban(Ascii, Ascii, u32),
    96         21 => BanIP(Ascii, Ascii, u32),
   101         21 => BanIP(Ascii, Ascii, u32),
    97         22 => BanNick(Ascii, Ascii, u32),
   102         22 => BanNick(Ascii, Ascii, u32),
    98         23 => BanList(),
   103         23 => BanList(),