From d46c99abe8671479c48b003bf06e98eda7eb85ab Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 12 Feb 2016 00:17:24 -0800 Subject: std: Funnel read_to_end through to one location This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`. --- src/libstd/sys/common/net.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libstd/sys/common') diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index ca4f6e19882..aa92e5be114 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -225,6 +225,10 @@ impl TcpStream { self.inner.read(buf) } + pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { + self.inner.read_to_end(buf) + } + pub fn write(&self, buf: &[u8]) -> io::Result { let len = cmp::min(buf.len(), ::max_value() as usize) as wrlen_t; let ret = try!(cvt(unsafe { -- cgit 1.4.1-3-g733a5