mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-13 00:00:32 +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
+2
-2
@@ -38,7 +38,7 @@ use crate::loom::sync::atomic::{self, AtomicPtr, AtomicUsize, Ordering};
|
||||
///
|
||||
/// buf.put_u8(b'h');
|
||||
/// buf.put_u8(b'e');
|
||||
/// buf.put("llo");
|
||||
/// buf.put(&b"llo"[..]);
|
||||
///
|
||||
/// assert_eq!(&buf[..], b"hello");
|
||||
///
|
||||
@@ -219,7 +219,7 @@ impl BytesMut {
|
||||
/// use std::thread;
|
||||
///
|
||||
/// let mut b = BytesMut::with_capacity(64);
|
||||
/// b.put("hello world");
|
||||
/// b.put(&b"hello world"[..]);
|
||||
/// let b1 = b.freeze();
|
||||
/// let b2 = b1.clone();
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user