fix vecbuf bytes_vec

This commit is contained in:
quininer 2018-08-16 22:35:50 +08:00
parent 4a2354c1cc
commit f70ad6d822

View File

@ -171,7 +171,11 @@ impl<'a, 'b> Buf for VecBuf<'a, 'b> {
fn bytes_vec<'c>(&'c self, dst: &mut [&'c IoVec]) -> usize {
let len = cmp::min(self.inner.len() - self.pos, dst.len());
for i in 0..len {
if len > 0 {
dst[0] = self.bytes().into();
}
for i in 1..len {
dst[i] = self.inner[self.pos + i].into();
}