Improve Buf/MutBuf impl for Cursor

This commit is contained in:
Carl Lerche
2016-08-05 22:19:37 -07:00
parent b6a424d892
commit 16b4266c3c
2 changed files with 31 additions and 22 deletions
+4 -1
View File
@@ -1,9 +1,10 @@
use bytes::{Buf, MutBuf};
use std::usize;
use std::io::{Cursor};
#[test]
pub fn test_fresh_cursor_vec() {
use bytes::Buf;
let mut buf = Cursor::new(b"hello".to_vec());
assert_eq!(buf.remaining(), 5);
@@ -27,6 +28,8 @@ pub fn test_fresh_cursor_vec() {
#[test]
pub fn test_vec_as_mut_buf() {
use bytes::MutBuf;
let mut buf = Vec::with_capacity(64);
assert_eq!(buf.remaining(), usize::MAX);