mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
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:
committed by
Carl Lerche
parent
43ac8e5494
commit
491ebbf79a
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user