Skip to content

Commit

Permalink
Mark BytesMut::extend_from_slice as inline (#595)
Browse files Browse the repository at this point in the history
This function can be hot in applications that do a lot of encoding. Ideally would do the same for `<BytesMut as BufMut>::put_slice` and `<BytesMut as BufMut::put_u8`.
  • Loading branch information
samanpa committed Feb 4, 2023
1 parent 21ed332 commit 74b04c7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ impl BytesMut {
///
/// assert_eq!(b"aaabbbcccddd", &buf[..]);
/// ```
#[inline]
pub fn extend_from_slice(&mut self, extend: &[u8]) {
let cnt = extend.len();
self.reserve(cnt);
Expand Down

0 comments on commit 74b04c7

Please sign in to comment.