diff options
author | 2024-03-03 08:59:30 -0500 | |
---|---|---|
committer | 2024-03-03 22:59:30 +0900 | |
commit | c5fae00c76dbd1af7ea7b6cde7a9281d82ee7cd2 (patch) | |
tree | e10130453982b02e2b30605aba11ad6b28d7084f /src/buf/buf_impl.rs | |
parent | 99584cc10d66cb6880a20c5ac9b9a960f9c17823 (diff) | |
download | bytes-c5fae00c76dbd1af7ea7b6cde7a9281d82ee7cd2.tar.gz bytes-c5fae00c76dbd1af7ea7b6cde7a9281d82ee7cd2.tar.zst bytes-c5fae00c76dbd1af7ea7b6cde7a9281d82ee7cd2.zip |
copy_to_bytes: Add panic section to docs (#676)
Fixes #454.
Diffstat (limited to '')
-rw-r--r-- | src/buf/buf_impl.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buf/buf_impl.rs b/src/buf/buf_impl.rs index 9367eb2..38ecf4b 100644 --- a/src/buf/buf_impl.rs +++ b/src/buf/buf_impl.rs @@ -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; |