mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
switch also the default implementation for read_vectored
This commit is contained in:
parent
c170bf9927
commit
d39dc0ab23
1 changed files with 2 additions and 13 deletions
|
@ -175,23 +175,12 @@ pub fn read_buf(&self, buf: BorrowedCursor<'_>) -> io::Result<()> {
|
|||
}
|
||||
|
||||
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
|
||||
let mut size: isize = 0;
|
||||
|
||||
for i in bufs.iter_mut() {
|
||||
let ret: isize =
|
||||
cvt(unsafe { netc::read(self.0.as_raw_fd(), i.as_mut_ptr(), i.len()) })?;
|
||||
|
||||
if ret != 0 {
|
||||
size += ret;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(size.try_into().unwrap())
|
||||
crate::io::default_read_vectored(|b| self.read(b), bufs)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_read_vectored(&self) -> bool {
|
||||
true
|
||||
false
|
||||
}
|
||||
|
||||
fn recv_from_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<(usize, SocketAddr)> {
|
||||
|
|
Loading…
Reference in a new issue