Skip to content

Commit 6b56472

Browse files
committed
Update to new io_slice_advance interface
1 parent 0b29f22 commit 6b56472

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

futures-util/src/io/write_all_vectored.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use futures_core::task::{Context, Poll};
44
use futures_io::AsyncWrite;
55
use futures_io::IoSlice;
66
use std::io;
7-
use std::mem;
87
use std::pin::Pin;
98

109
/// Future for the
@@ -19,8 +18,9 @@ pub struct WriteAllVectored<'a, W: ?Sized + Unpin> {
1918
impl<W: ?Sized + Unpin> Unpin for WriteAllVectored<'_, W> {}
2019

2120
impl<'a, W: AsyncWrite + ?Sized + Unpin> WriteAllVectored<'a, W> {
22-
pub(super) fn new(writer: &'a mut W, bufs: &'a mut [IoSlice<'a>]) -> Self {
23-
Self { writer, bufs: IoSlice::advance(bufs, 0) }
21+
pub(super) fn new(writer: &'a mut W, mut bufs: &'a mut [IoSlice<'a>]) -> Self {
22+
IoSlice::advance_slices(&mut bufs, 0);
23+
Self { writer, bufs }
2424
}
2525
}
2626

@@ -34,7 +34,7 @@ impl<W: AsyncWrite + ?Sized + Unpin> Future for WriteAllVectored<'_, W> {
3434
if n == 0 {
3535
return Poll::Ready(Err(io::ErrorKind::WriteZero.into()));
3636
} else {
37-
this.bufs = IoSlice::advance(mem::take(&mut this.bufs), n);
37+
IoSlice::advance_slices(&mut this.bufs, n);
3838
}
3939
}
4040

0 commit comments

Comments
 (0)