1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 use sys
::{ReadSysCall, WriteSysCall}
;
19 pub fn new() -> io
::Result
<Stdin
> {
23 pub fn read(&self, data
: &mut [u8]) -> io
::Result
<usize> {
24 Ok(ReadSysCall
::perform(0, data
))
29 pub fn new() -> io
::Result
<Stdout
> {
33 pub fn write(&self, data
: &[u8]) -> io
::Result
<usize> {
34 WriteSysCall
::perform(1, data
);
38 pub fn flush(&self) -> io
::Result
<()> {
44 pub fn new() -> io
::Result
<Stderr
> {
48 pub fn write(&self, data
: &[u8]) -> io
::Result
<usize> {
49 WriteSysCall
::perform(2, data
);
53 pub fn flush(&self) -> io
::Result
<()> {
58 impl io
::Write
for Stderr
{
59 fn write(&mut self, data
: &[u8]) -> io
::Result
<usize> {
62 fn flush(&mut self) -> io
::Result
<()> {
67 pub const STDIN_BUF_SIZE
: usize = 0;
69 pub fn is_ebadf(_err
: &io
::Error
) -> bool
{
73 pub fn stderr_prints_nothing() -> bool
{
74 !cfg
!(feature
= "wasm_syscall")