gameServer2/src/protocol/mod.rs
changeset 13438 da71e0d88a1c
parent 13416 cdf69667593b
child 13713 59ea2403f62d
--- a/gameServer2/src/protocol/mod.rs	Tue Jul 03 23:05:09 2018 +0300
+++ b/gameServer2/src/protocol/mod.rs	Wed Jul 04 00:01:25 2018 +0300
@@ -1,7 +1,10 @@
 use netbuf;
-use std::io::Read;
-use std::io::Result;
-use nom::IResult;
+use std::{
+    io::{Read, Result}
+};
+use nom::{
+    IResult, Err
+};
 
 pub mod messages;
 pub mod test;
@@ -27,12 +30,12 @@
     pub fn extract_messages(&mut self) -> Vec<messages::HWProtocolMessage> {
         let parse_result = parser::extract_messages(&self.buf[..]);
         match parse_result {
-            IResult::Done(tail, msgs) => {
+            Ok((tail, msgs)) => {
                 self.consumed = self.buf.len() - self.consumed - tail.len();
                 msgs
             },
-            IResult::Incomplete(_) => unreachable!(),
-            IResult::Error(_) => unreachable!(),
+            Err(Err::Incomplete(_)) => unreachable!(),
+            Err(Err::Error(_)) | Err(Err::Failure(_)) => unreachable!(),
         }
     }