Skip to content

Commit

Permalink
Handle limit == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed Jan 13, 2025
1 parent 6000c62 commit 2310cd3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/buf/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ impl<T: Buf> Buf for Take<T> {

#[cfg(feature = "std")]
fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize {
if self.limit == 0 {
return 0;
}

let mut slices = [IoSlice::new(&[]); 16];

let cnt = self.inner.chunks_vectored(&mut slices[..dst.len().min(16)]);
Expand Down

0 comments on commit 2310cd3

Please sign in to comment.