Skip to content

Commit

Permalink
Backport has_remaining performance optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimush committed May 14, 2024
1 parent 930f1a2 commit 2724137
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ impl<T: Buf> Buf for BufList<T> {
self.bufs.iter().map(|buf| buf.remaining()).sum()
}

#[inline]
fn has_remaining(&self) -> bool {
self.bufs.iter().any(|buf| buf.has_remaining())
}

#[inline]
fn chunk(&self) -> &[u8] {
self.bufs.front().map(Buf::chunk).unwrap_or_default()
Expand Down

0 comments on commit 2724137

Please sign in to comment.