Remove Buf impl for &str (#301)

A `&str` cannot arbitrarily advance bytes, since it will panic if
advanced to the middle of a Unicode segment.
This commit is contained in:
Sean McArthur
2019-10-16 11:28:50 -07:00
committed by Carl Lerche
parent 43ac8e5494
commit 491ebbf79a
4 changed files with 9 additions and 26 deletions
+1 -1
View File
@@ -402,7 +402,7 @@ fn reserve_vec_recycling() {
let mut bytes = BytesMut::with_capacity(16);
assert_eq!(bytes.capacity(), 16);
let addr = bytes.as_ptr() as usize;
bytes.put("0123456789012345");
bytes.put("0123456789012345".as_bytes());
assert_eq!(bytes.as_ptr() as usize, addr);
bytes.advance(10);
assert_eq!(bytes.capacity(), 6);