add mark/reset feature to ByteBuf and RingBuf

This commit is contained in:
Dan Burkert
2015-04-11 15:18:32 -07:00
parent 40f1d1aa77
commit 4d645c7f53
4 changed files with 110 additions and 5 deletions
+4
View File
@@ -30,6 +30,10 @@ pub fn test_byte_buf_read_write() {
let mut buf = buf.flip();
let mut dst = [0; 5];
buf.mark();
assert_eq!(5, buf.read(&mut dst[..]).unwrap());
assert_eq!(b"hello", &dst);
buf.reset();
assert_eq!(5, buf.read(&mut dst[..]).unwrap());
assert_eq!(b"hello", &dst);