about summary refs log tree commit diff
path: root/src/libstd/sys/sgx
diff options
context:
space:
mode:
authorPaul Dicker <pitdicker@gmail.com>2019-02-20 08:18:29 +0100
committerPaul Dicker <pitdicker@gmail.com>2019-02-20 19:27:03 +0100
commit6464e32ea97fe0b18f75becc82cba9b19dfe453c (patch)
tree51fd2b3c7c2b6a1101419114a37839bb28ed7bc2 /src/libstd/sys/sgx
parentb09803e8694b3ad83f988e30b4f0a3903ebe2632 (diff)
downloadrust-6464e32ea97fe0b18f75becc82cba9b19dfe453c.tar.gz
rust-6464e32ea97fe0b18f75becc82cba9b19dfe453c.zip
Use standard Read/Write traits in sys::stdio
Diffstat (limited to 'src/libstd/sys/sgx')
-rw-r--r--src/libstd/sys/sgx/stdio.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/libstd/sys/sgx/stdio.rs b/src/libstd/sys/sgx/stdio.rs
index c8efb931d6f..57d66ed9a85 100644
--- a/src/libstd/sys/sgx/stdio.rs
+++ b/src/libstd/sys/sgx/stdio.rs
@@ -16,32 +16,38 @@ fn with_std_fd<F: FnOnce(&FileDesc) -> R, R>(fd: abi::Fd, f: F) -> R {
 
 impl Stdin {
     pub fn new() -> io::Result<Stdin> { Ok(Stdin(())) }
+}
 
-    pub fn read(&self, data: &mut [u8]) -> io::Result<usize> {
-        with_std_fd(abi::FD_STDIN, |fd| fd.read(data))
+impl io::Read for Stdin {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        with_std_fd(abi::FD_STDIN, |fd| fd.read(buf))
     }
 }
 
 impl Stdout {
     pub fn new() -> io::Result<Stdout> { Ok(Stdout(())) }
+}
 
-    pub fn write(&self, data: &[u8]) -> io::Result<usize> {
-        with_std_fd(abi::FD_STDOUT, |fd| fd.write(data))
+impl io::Write for Stdout {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        with_std_fd(abi::FD_STDOUT, |fd| fd.write(buf))
     }
 
-    pub fn flush(&self) -> io::Result<()> {
+    fn flush(&mut self) -> io::Result<()> {
         with_std_fd(abi::FD_STDOUT, |fd| fd.flush())
     }
 }
 
 impl Stderr {
     pub fn new() -> io::Result<Stderr> { Ok(Stderr(())) }
+}
 
-    pub fn write(&self, data: &[u8]) -> io::Result<usize> {
-        with_std_fd(abi::FD_STDERR, |fd| fd.write(data))
+impl io::Write for Stderr {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        with_std_fd(abi::FD_STDERR, |fd| fd.write(buf))
     }
 
-    pub fn flush(&self) -> io::Result<()> {
+    fn flush(&mut self) -> io::Result<()> {
         with_std_fd(abi::FD_STDERR, |fd| fd.flush())
     }
 }