diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-02-12 00:17:24 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-03-08 17:45:44 -0800 |
| commit | d46c99abe8671479c48b003bf06e98eda7eb85ab (patch) | |
| tree | 9cd992343e114fea26c3be8383a2d304e06e4a56 /src/libstd/sys/unix/net.rs | |
| parent | eabfc160f87ccc0b296f49af7fe688506580c473 (diff) | |
| download | rust-d46c99abe8671479c48b003bf06e98eda7eb85ab.tar.gz rust-d46c99abe8671479c48b003bf06e98eda7eb85ab.zip | |
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`.
Diffstat (limited to 'src/libstd/sys/unix/net.rs')
| -rw-r--r-- | src/libstd/sys/unix/net.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index 8785da51986..acf501d5fda 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -116,6 +116,10 @@ impl Socket { self.0.read(buf) } + pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> { + self.0.read_to_end(buf) + } + pub fn set_timeout(&self, dur: Option<Duration>, kind: libc::c_int) -> io::Result<()> { let timeout = match dur { Some(dur) => { |
