Skip to content

Instantly share code, notes, and snippets.

@marmistrz
Created July 3, 2018 20:27
Show Gist options
  • Save marmistrz/338cc9016d65e54125b4676dbe54aec8 to your computer and use it in GitHub Desktop.
Save marmistrz/338cc9016d65e54125b4676dbe54aec8 to your computer and use it in GitHub Desktop.
diff -r a0c3431f60ac gameServer2/Cargo.toml
--- a/gameServer2/Cargo.toml Tue Jul 03 23:05:09 2018 +0300
+++ b/gameServer2/Cargo.toml Tue Jul 03 22:27:45 2018 +0200
@@ -8,7 +8,7 @@
mio = "0.6"
slab = "0.4"
netbuf = "0.4.0"
-nom = "3.2"
+nom = "4"
env_logger = "0.4"
log = "0.4"
proptest = "0.8"
diff -r a0c3431f60ac gameServer2/src/protocol/mod.rs
--- a/gameServer2/src/protocol/mod.rs Tue Jul 03 23:05:09 2018 +0300
+++ b/gameServer2/src/protocol/mod.rs Tue Jul 03 22:27:45 2018 +0200
@@ -25,15 +25,9 @@
}
pub fn extract_messages(&mut self) -> Vec<messages::HWProtocolMessage> {
- let parse_result = parser::extract_messages(&self.buf[..]);
- match parse_result {
- IResult::Done(tail, msgs) => {
- self.consumed = self.buf.len() - self.consumed - tail.len();
- msgs
- },
- IResult::Incomplete(_) => unreachable!(),
- IResult::Error(_) => unreachable!(),
- }
+ let (tail, msgs) = parser::extract_messages(&self.buf[..]).unwrap();
+ self.consumed = self.buf.len() - self.consumed - tail.len();
+ msgs
}
pub fn sweep(&mut self) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment