Skip to content

Commit

Permalink
copy_to_bytes: Add panic section to docs (#676)
Browse files Browse the repository at this point in the history
Fixes #454.
  • Loading branch information
braddunbar authored Mar 3, 2024
1 parent 99584cc commit c5fae00
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/buf/buf_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c5fae00

Please sign in to comment.