copy_to_bytes: Add panic section to docs (#676)

Fixes #454.
This commit is contained in:
Brad Dunbar
2024-03-03 22:59:30 +09:00
committed by GitHub
parent 99584cc10d
commit c5fae00c76
+4
View File
@@ -1120,6 +1120,10 @@ pub trait Buf {
/// let bytes = (&b"hello world"[..]).copy_to_bytes(5);
/// assert_eq!(&bytes[..], &b"hello"[..]);
/// ```
///
/// # Panics
///
/// This function panics if `len > self.remaining()`.
fn copy_to_bytes(&mut self, len: usize) -> crate::Bytes {
use super::BufMut;