From 3cb22c585c483a9c077863f5bfbadd5227ce4b31 Mon Sep 17 00:00:00 2001 From: Yaroslav Shalenyk Date: Tue, 7 Aug 2018 21:38:54 +0300 Subject: [PATCH] Fixed build --- Cargo.toml | 1 + src/lib.rs | 1 + src/msg.rs | 9 +++++---- src/reader.rs | 3 ++- src/writer.rs | 7 ++++--- tests/reader.rs | 3 ++- tests/writer.rs | 3 ++- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1f90dfd..2b696fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ memmap = "*" rmp = "*" rmp-serde = "*" serde = "*" +serde_bytes = "*" tempdir = "*" tempfile = "*" time = "*" diff --git a/src/lib.rs b/src/lib.rs index 4a97aa8..5f55c56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,7 @@ extern crate byteorder; pub extern crate rmp; pub extern crate rmp_serde; extern crate serde; +extern crate serde_bytes; extern crate tempdir; extern crate tempfile; extern crate time; diff --git a/src/msg.rs b/src/msg.rs index b464f9d..9215176 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -3,7 +3,8 @@ use std; use rmp; pub use rmp_serde; use serde; -use serde::bytes::ByteBuf; +use serde_bytes; +use serde_bytes::ByteBuf; pub use serde::{Deserialize, Serialize}; use errors::*; @@ -66,8 +67,8 @@ macro_rules! error_response { pub const NIL: Option = None; -pub fn bytes(data: &[u8]) -> serde::bytes::Bytes { - serde::bytes::Bytes::new(data) +pub fn bytes(data: &[u8]) -> serde_bytes::Bytes { + serde_bytes::Bytes::new(data) } #[derive(Debug, PartialEq)] @@ -158,7 +159,7 @@ impl ZeoIter { fn pre_parse(mut reader: &mut io::Read) -> Result<(i64, String)> { - let array_size = try!(rmp::decode::read_array_size(&mut reader) + let array_size = try!(rmp::decode::read_array_len(&mut reader) .chain_err(|| "get mess size")); if array_size != 3 { return Err(format!("Bad array size {}", array_size).into()); diff --git a/src/reader.rs b/src/reader.rs index 1ba0f37..0996cdd 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2,6 +2,7 @@ use std; use std::collections::BTreeMap; use serde; +use serde_bytes::Bytes; use storage; use writer; @@ -84,7 +85,7 @@ pub fn reader( }, Zeo::NewOids(id) => { let oids = fs.new_oids(); - let oids: Vec = + let oids: Vec = oids.iter().map(| oid | bytes(oid)).collect(); respond!(sender, id, oids) }, diff --git a/src/writer.rs b/src/writer.rs index 131af2a..0766060 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -2,6 +2,7 @@ use std; use std::collections::{BTreeMap, HashMap}; use serde; +use serde_bytes; use storage; use transaction; @@ -132,10 +133,10 @@ pub fn writer( try!(trans.locked()); let conflicts = try!(fs.stage(&mut trans)); let conflict_maps: - Vec> = + Vec> = conflicts.iter() .map(| c | { - let mut m: BTreeMap = + let mut m: BTreeMap = BTreeMap::new(); m.insert("oid".to_string(), bytes(&c.oid)); m.insert("serial".to_string(), bytes(&c.serial)); @@ -168,7 +169,7 @@ pub fn writer( async!(writer, "info", (info,)); }, Zeo::Invalidate(tid, oids) => { - let oids: Vec = + let oids: Vec = oids.iter().map(| oid | bytes(oid)).collect(); async!(writer, "invalidateTransaction", (bytes(&tid), oids)); }, diff --git a/tests/reader.rs b/tests/reader.rs index a8957e7..6cec6cf 100644 --- a/tests/reader.rs +++ b/tests/reader.rs @@ -2,6 +2,7 @@ extern crate byteorder; extern crate serde; +extern crate serde_bytes; #[macro_use] extern crate byteserver; @@ -9,7 +10,7 @@ extern crate pipe; use std::collections::BTreeMap; -use serde::bytes::ByteBuf; +use serde_bytes::ByteBuf; use byteserver::msg::*; use byteserver::util::*; diff --git a/tests/writer.rs b/tests/writer.rs index a9d5290..f1a6e2a 100644 --- a/tests/writer.rs +++ b/tests/writer.rs @@ -3,6 +3,7 @@ extern crate byteorder; extern crate serde; +extern crate serde_bytes; #[macro_use] extern crate byteserver; @@ -10,7 +11,7 @@ extern crate pipe; use std::collections::BTreeMap; -use serde::bytes::ByteBuf; +use serde_bytes::ByteBuf; use byteserver::msg::*; use byteserver::util::*;