diff options
Diffstat (limited to 'src/libstd/sys/windows/stdio.rs')
| -rw-r--r-- | src/libstd/sys/windows/stdio.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 1cd05b61d25..5a8705bf0cb 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -18,6 +18,7 @@ use sync::Mutex; use sys::c; use sys::cvt; use sys::handle::Handle; +use sys_common::io::read_to_end_uninitialized; pub struct NoClose(Option<Handle>); @@ -113,6 +114,22 @@ impl Stdin { // MemReader shouldn't error here since we just filled it utf8.read(buf) } + + pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> { + let mut me = self; + (&mut me).read_to_end(buf) + } +} + +#[unstable(reason = "not public", issue = "0", feature = "fd_read")] +impl<'a> Read for &'a Stdin { + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + (**self).read(buf) + } + + fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { + unsafe { read_to_end_uninitialized(self, buf) } + } } impl Stdout { |
