Skip to content

Commit

Permalink
Replace vec with bufs in AsyncRead::poll_read_vectored
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored and cramertj committed May 17, 2019
1 parent 63d5288 commit 85162dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions futures-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ mod if_std {
/// `Interrupted`. Implementations must convert `WouldBlock` into
/// `Poll::Pending` and either internally retry or convert
/// `Interrupted` into another error kind.
fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, vec: &mut [IoSliceMut<'_>])
fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
-> Poll<Result<usize>>
{
if let Some(ref mut first_iovec) = vec.get_mut(0) {
if let Some(ref mut first_iovec) = bufs.get_mut(0) {
self.poll_read(cx, first_iovec)
} else {
// `vec` is empty.
// `bufs` is empty.
Poll::Ready(Ok(0))
}
}
Expand Down Expand Up @@ -346,10 +346,10 @@ mod if_std {
Pin::new(&mut **self).poll_read(cx, buf)
}

fn poll_read_vectored(mut self: Pin<&mut Self>, cx: &mut Context<'_>, vec: &mut [IoSliceMut<'_>])
fn poll_read_vectored(mut self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
-> Poll<Result<usize>>
{
Pin::new(&mut **self).poll_read_vectored(cx, vec)
Pin::new(&mut **self).poll_read_vectored(cx, bufs)
}
}
}
Expand Down Expand Up @@ -377,10 +377,10 @@ mod if_std {
Pin::get_mut(self).as_mut().poll_read(cx, buf)
}

fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, vec: &mut [IoSliceMut<'_>])
fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
-> Poll<Result<usize>>
{
Pin::get_mut(self).as_mut().poll_read_vectored(cx, vec)
Pin::get_mut(self).as_mut().poll_read_vectored(cx, bufs)
}
}

Expand All @@ -398,10 +398,10 @@ mod if_std {
Poll::Ready(StdIo::Read::read(&mut *self, buf))
}

fn poll_read_vectored(mut self: Pin<&mut Self>, _: &mut Context<'_>, vec: &mut [IoSliceMut<'_>])
fn poll_read_vectored(mut self: Pin<&mut Self>, _: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
-> Poll<Result<usize>>
{
Poll::Ready(StdIo::Read::read_vectored(&mut *self, vec))
Poll::Ready(StdIo::Read::read_vectored(&mut *self, bufs))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions futures-util/src/io/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ impl<R: AsyncRead> AsyncRead for ReadHalf<R> {
lock_and_then(&self.handle, cx, |l, cx| l.poll_read(cx, buf))
}

fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, vec: &mut [IoSliceMut<'_>])
fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>])
-> Poll<io::Result<usize>>
{
lock_and_then(&self.handle, cx, |l, cx| l.poll_read_vectored(cx, vec))
lock_and_then(&self.handle, cx, |l, cx| l.poll_read_vectored(cx, bufs))
}
}

Expand Down

0 comments on commit 85162dc

Please sign in to comment.