1
1
use fortanix_sgx_abi as abi;
2
2
3
- use crate :: io;
3
+ use crate :: io:: { self , BorrowedCursor , IoSlice , IoSliceMut } ;
4
4
use crate :: sys:: fd:: FileDesc ;
5
5
6
6
pub struct Stdin ( ( ) ) ;
@@ -24,6 +24,19 @@ impl io::Read for Stdin {
24
24
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
25
25
with_std_fd ( abi:: FD_STDIN , |fd| fd. read ( buf) )
26
26
}
27
+
28
+ fn read_buf ( & mut self , buf : BorrowedCursor < ' _ > ) -> io:: Result < ( ) > {
29
+ with_std_fd ( abi:: FD_STDIN , |fd| fd. read_buf ( buf) )
30
+ }
31
+
32
+ fn read_vectored ( & mut self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
33
+ with_std_fd ( abi:: FD_STDIN , |fd| fd. read_vectored ( bufs) )
34
+ }
35
+
36
+ #[ inline]
37
+ fn is_read_vectored ( & self ) -> bool {
38
+ true
39
+ }
27
40
}
28
41
29
42
impl Stdout {
@@ -40,6 +53,15 @@ impl io::Write for Stdout {
40
53
fn flush ( & mut self ) -> io:: Result < ( ) > {
41
54
with_std_fd ( abi:: FD_STDOUT , |fd| fd. flush ( ) )
42
55
}
56
+
57
+ fn write_vectored ( & mut self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
58
+ with_std_fd ( abi:: FD_STDOUT , |fd| fd. write_vectored ( bufs) )
59
+ }
60
+
61
+ #[ inline]
62
+ fn is_write_vectored ( & self ) -> bool {
63
+ true
64
+ }
43
65
}
44
66
45
67
impl Stderr {
@@ -56,6 +78,15 @@ impl io::Write for Stderr {
56
78
fn flush ( & mut self ) -> io:: Result < ( ) > {
57
79
with_std_fd ( abi:: FD_STDERR , |fd| fd. flush ( ) )
58
80
}
81
+
82
+ fn write_vectored ( & mut self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
83
+ with_std_fd ( abi:: FD_STDERR , |fd| fd. write_vectored ( bufs) )
84
+ }
85
+
86
+ #[ inline]
87
+ fn is_write_vectored ( & self ) -> bool {
88
+ true
89
+ }
59
90
}
60
91
61
92
pub const STDIN_BUF_SIZE : usize = crate :: sys:: io:: DEFAULT_BUF_SIZE ;
0 commit comments