]> git.proxmox.com Git - rustc.git/blob - src/libstd/sys/wasm/stdio.rs
New upstream version 1.42.0+dfsg0+pve1
[rustc.git] / src / libstd / sys / wasm / 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 fn new() -> io::Result<Stdin> {
9 Ok(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 fn new() -> io::Result<Stdout> {
21 Ok(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 fn new() -> io::Result<Stderr> {
37 Ok(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 }