From f4018a431e3aefd38411142d40f67ca8ff6c5e14 Mon Sep 17 00:00:00 2001 From: Malte Schwarzkopf Date: Sun, 19 Mar 2017 14:12:17 -0400 Subject: [PATCH] bincode 1.0.0-alpha6 changed `SizeLimit` to a trait (#134) Unfortunately, cargo's semantic versioning gets confused by the "-alpha" suffix in current bincode versions (I think): even though tarpc's Cargo.toml specified version "1.0.0-alpha4", cargo will download the more recent "1.0.0-alpha6", which has breaking changes to the `SizeLimit` enum. This change makes tarpc work with bincode 1.0.0-alpha6 and updates the dependency. --- Cargo.toml | 2 +- src/protocol.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 035b8d70..cf5f3915 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ description = "An RPC framework for Rust with a focus on ease of use." travis-ci = { repository = "google/tarpc" } [dependencies] -bincode = "1.0.0-alpha4" +bincode = "1.0.0-alpha6" byteorder = "1.0" cfg-if = "0.1.0" futures = "0.1.7" diff --git a/src/protocol.rs b/src/protocol.rs index ec9ed962..3af2abf1 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -4,7 +4,7 @@ // This file may not be copied, modified, or distributed except according to those terms. use {serde, tokio_core}; -use bincode::{self, SizeLimit}; +use bincode::{self, Infinite}; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::io::{self, Cursor}; use std::marker::PhantomData; @@ -47,7 +47,7 @@ impl tokio_core::io::Codec for Codec buf.write_u64::(bincode::serialized_size(&message)).unwrap(); bincode::serialize_into(buf, &message, - SizeLimit::Infinite) + Infinite) .map_err(|serialize_err| io::Error::new(io::ErrorKind::Other, serialize_err))?; trace!("Encoded buffer: {:?}", buf); Ok(()) @@ -91,7 +91,7 @@ impl tokio_core::io::Codec for Codec Payload { id, len } => { let payload = buf.drain_to(len as usize); let result = bincode::deserialize_from(&mut Cursor::new(payload), - SizeLimit::Infinite); + Infinite); // Reset the state machine because, either way, we're done processing this // message. self.state = Id;