std/sys/stdio/
unsupported.rs1use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
2
3pub struct Stdin;
4pub struct Stdout;
5pub type Stderr = Stdout;
6
7impl Stdin {
8 pub const fn new() -> Stdin {
9 Stdin
10 }
11}
12
13impl io::Read for Stdin {
14 #[inline]
15 fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
16 Ok(0)
17 }
18
19 #[inline]
20 fn read_buf(&mut self, _cursor: BorrowedCursor<'_>) -> io::Result<()> {
21 Ok(())
22 }
23
24 #[inline]
25 fn read_vectored(&mut self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
26 Ok(0)
27 }
28
29 #[inline]
30 fn is_read_vectored(&self) -> bool {
31 false
34 }
35
36 #[inline]
37 fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
38 if !buf.is_empty() { Err(io::Error::READ_EXACT_EOF) } else { Ok(()) }
39 }
40
41 #[inline]
42 fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
43 if cursor.capacity() != 0 { Err(io::Error::READ_EXACT_EOF) } else { Ok(()) }
44 }
45
46 #[inline]
47 fn read_to_end(&mut self, _buf: &mut Vec<u8>) -> io::Result<usize> {
48 Ok(0)
49 }
50
51 #[inline]
52 fn read_to_string(&mut self, _buf: &mut String) -> io::Result<usize> {
53 Ok(0)
54 }
55}
56
57impl Stdout {
58 pub const fn new() -> Stdout {
59 Stdout
60 }
61}
62
63impl io::Write for Stdout {
64 #[inline]
65 fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
66 Ok(buf.len())
67 }
68
69 #[inline]
70 fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
71 let total_len = bufs.iter().map(|b| b.len()).sum();
72 Ok(total_len)
73 }
74
75 #[inline]
76 fn is_write_vectored(&self) -> bool {
77 true
78 }
79
80 #[inline]
81 fn write_all(&mut self, _buf: &[u8]) -> io::Result<()> {
82 Ok(())
83 }
84
85 #[inline]
86 fn write_all_vectored(&mut self, _bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
87 Ok(())
88 }
89
90 #[inline]
93 fn flush(&mut self) -> io::Result<()> {
94 Ok(())
95 }
96}
97
98pub const STDIN_BUF_SIZE: usize = 0;
99
100pub fn is_ebadf(_err: &io::Error) -> bool {
101 true
102}
103
104pub fn panic_output() -> Option<Vec<u8>> {
105 None
106}