]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/unsupported/stdio.rs
Rollup merge of #105482 - wesleywiser:fix_debuginfo_ub, r=tmiasko
[rust.git] / library / std / src / sys / unsupported / stdio.rs
1 use crate::io;
2
3 pub struct Stdin;
4 pub struct Stdout;
5 pub struct Stderr;
6
7 impl Stdin {
8     pub const fn new() -> Stdin {
9         Stdin
10     }
11 }
12
13 impl io::Read for Stdin {
14     fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
15         Ok(0)
16     }
17 }
18
19 impl Stdout {
20     pub const fn new() -> Stdout {
21         Stdout
22     }
23 }
24
25 impl io::Write for Stdout {
26     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
27         Ok(buf.len())
28     }
29
30     fn flush(&mut self) -> io::Result<()> {
31         Ok(())
32     }
33 }
34
35 impl Stderr {
36     pub const fn new() -> Stderr {
37         Stderr
38     }
39 }
40
41 impl io::Write for Stderr {
42     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
43         Ok(buf.len())
44     }
45
46     fn flush(&mut self) -> io::Result<()> {
47         Ok(())
48     }
49 }
50
51 pub const STDIN_BUF_SIZE: usize = 0;
52
53 pub fn is_ebadf(_err: &io::Error) -> bool {
54     true
55 }
56
57 pub fn panic_output() -> Option<Vec<u8>> {
58     None
59 }