Track Rust master

This commit is contained in:
Carl Lerche
2015-03-23 17:12:39 -07:00
parent 3f9b7f6d46
commit a87dea0bd4
4 changed files with 30 additions and 30 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ exclude = [
] ]
[dev-dependencies] [dev-dependencies]
rand = "0.1.2" rand = "0.2.1"
[[bench]] [[bench]]
+2 -2
View File
@@ -61,7 +61,7 @@ pub trait Buf {
/// let mut dst = [0; 5]; /// let mut dst = [0; 5];
/// ///
/// buf.read_slice(&mut dst); /// buf.read_slice(&mut dst);
/// assert_eq!(b"hello", dst); /// assert_eq!(b"hello", &dst);
/// assert_eq!(6, buf.remaining()); /// assert_eq!(6, buf.remaining());
/// ``` /// ```
fn read_slice(&mut self, dst: &mut [u8]) -> usize { fn read_slice(&mut self, dst: &mut [u8]) -> usize {
@@ -144,7 +144,7 @@ pub trait MutBuf : Sized {
/// assert_eq!(1, buf.remaining()); /// assert_eq!(1, buf.remaining());
/// } /// }
/// ///
/// assert_eq!(b"hello\0", dst); /// assert_eq!(b"hello\0", &dst);
/// ``` /// ```
fn write_slice(&mut self, src: &[u8]) -> usize { fn write_slice(&mut self, src: &[u8]) -> usize {
let mut off = 0; let mut off = 0;
+6 -6
View File
@@ -21,26 +21,26 @@ pub fn test_initial_buf_empty() {
pub fn test_byte_buf_read_write() { pub fn test_byte_buf_read_write() {
let mut buf = ByteBuf::mut_with_capacity(32); let mut buf = ByteBuf::mut_with_capacity(32);
buf.write(b"hello world").unwrap(); buf.write(b"hello world".as_slice()).unwrap();
assert_eq!(21, buf.remaining()); assert_eq!(21, buf.remaining());
buf.write(b" goodbye").unwrap(); buf.write(b" goodbye".as_slice()).unwrap();
assert_eq!(13, buf.remaining()); assert_eq!(13, buf.remaining());
let mut buf = buf.flip(); let mut buf = buf.flip();
let mut dst = [0; 5]; let mut dst = [0; 5];
assert_eq!(5, buf.read(dst.as_mut_slice()).unwrap()); assert_eq!(5, buf.read(dst.as_mut_slice()).unwrap());
assert_eq!(b"hello", dst); assert_eq!(b"hello", &dst);
assert_eq!(5, buf.read(dst.as_mut_slice()).unwrap()); assert_eq!(5, buf.read(dst.as_mut_slice()).unwrap());
assert_eq!(b" worl", dst); assert_eq!(b" worl", &dst);
let mut dst = [0; 2]; let mut dst = [0; 2];
assert_eq!(2, buf.read(dst.as_mut_slice()).unwrap()); assert_eq!(2, buf.read(dst.as_mut_slice()).unwrap());
assert_eq!(b"d ", dst); assert_eq!(b"d ", &dst);
let mut dst = [0; 7]; let mut dst = [0; 7];
assert_eq!(7, buf.read(dst.as_mut_slice()).unwrap()); assert_eq!(7, buf.read(dst.as_mut_slice()).unwrap());
assert_eq!(b"goodbye", dst); assert_eq!(b"goodbye", &dst);
} }
+2 -2
View File
@@ -3,7 +3,7 @@ use bytes::traits::*;
use super::gen_bytes; use super::gen_bytes;
const TEST_BYTES_1: &'static [u8] = const TEST_BYTES_1: &'static [u8] =
&b"dblm4ng7jp4v9rdn1w6hhssmluoqrrrqj59rccl9 b"dblm4ng7jp4v9rdn1w6hhssmluoqrrrqj59rccl9
nkv2tm1t2da4jyku51ge7f8hv581gkki8lekmf5f nkv2tm1t2da4jyku51ge7f8hv581gkki8lekmf5f
1l44whp4aiwbvhkziw02292on4noyvuwjzsloqyc 1l44whp4aiwbvhkziw02292on4noyvuwjzsloqyc
5n0iyn4l6o6tgjhlek00mynfzb1wgcwj4mqp6zdr 5n0iyn4l6o6tgjhlek00mynfzb1wgcwj4mqp6zdr
@@ -14,7 +14,7 @@ const TEST_BYTES_1: &'static [u8] =
qvoian1ra7c6pvxabshgngldxa408p18l1fdet2h"; qvoian1ra7c6pvxabshgngldxa408p18l1fdet2h";
const TEST_BYTES_2: &'static [u8] = const TEST_BYTES_2: &'static [u8] =
&b"jmh14t79mllzj1ohxfj6fun7idwbks8oh35f83g6 b"jmh14t79mllzj1ohxfj6fun7idwbks8oh35f83g6
ryaowe86mmou5t1xa91uyg8e95wcu5mje1mswien ryaowe86mmou5t1xa91uyg8e95wcu5mje1mswien
tt4clgj029cw0pyuvfbvsgzdg1x7sr9qsjkf2b1t tt4clgj029cw0pyuvfbvsgzdg1x7sr9qsjkf2b1t
h43smgp1ea22lph17f78cel0cc2kjoht5281xuy8 h43smgp1ea22lph17f78cel0cc2kjoht5281xuy8