diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-04-10 12:51:25 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-04-10 12:51:25 -0700 |
| commit | acf3ddb5ad163ea98f8935b045fc6d15faefa454 (patch) | |
| tree | 14259cccc6d6a15409cc06a033bd459a0766eb43 /src/libstd/sys/unix/pipe.rs | |
| parent | 3750348daff89741e3153e0e120aa70a45ff5b68 (diff) | |
| download | rust-acf3ddb5ad163ea98f8935b045fc6d15faefa454.tar.gz rust-acf3ddb5ad163ea98f8935b045fc6d15faefa454.zip | |
std: Add `{read,write}_vectored` for more types
This commit implements the `{read,write}_vectored` methods on more types
in the standard library, namely:
* `std::fs::File`
* `std::process::ChildStd{in,out,err}`
* `std::io::Std{in,out,err}`
* `std::io::Std{in,out,err}Lock`
* `std::io::Std{in,out,err}Raw`
Where supported the OS implementations hook up to native support,
otherwise it falls back to the already-defaulted implementation.
Diffstat (limited to 'src/libstd/sys/unix/pipe.rs')
| -rw-r--r-- | src/libstd/sys/unix/pipe.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index bc3c026adab..a7792d42af9 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -1,4 +1,4 @@ -use crate::io; +use crate::io::{self, IoVec, IoVecMut}; use crate::mem; use crate::sync::atomic::{AtomicBool, Ordering}; use crate::sys::fd::FileDesc; @@ -60,10 +60,18 @@ impl AnonPipe { self.0.read(buf) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> { + self.0.read_vectored(bufs) + } + pub fn write(&self, buf: &[u8]) -> io::Result<usize> { self.0.write(buf) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result<usize> { + self.0.write_vectored(bufs) + } + pub fn fd(&self) -> &FileDesc { &self.0 } pub fn into_fd(self) -> FileDesc { self.0 } } |
