2 use crate::io::{IoSlice, IoSliceMut};
3 use crate::sys::hermit::abi;
10 pub fn new() -> Stdin {
15 impl io::Read for Stdin {
16 fn read(&mut self, data: &mut [u8]) -> io::Result<usize> {
17 self.read_vectored(&mut [IoSliceMut::new(data)])
20 fn read_vectored(&mut self, _data: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
25 fn is_read_vectored(&self) -> bool {
31 pub fn new() -> Stdout {
36 impl io::Write for Stdout {
37 fn write(&mut self, data: &[u8]) -> io::Result<usize> {
40 unsafe { len = abi::write(1, data.as_ptr() as *const u8, data.len()) }
43 Err(io::Error::new(io::ErrorKind::Other, "Stdout is not able to print"))
49 fn write_vectored(&mut self, data: &[IoSlice<'_>]) -> io::Result<usize> {
52 unsafe { len = abi::write(1, data.as_ptr() as *const u8, data.len()) }
55 Err(io::Error::new(io::ErrorKind::Other, "Stdout is not able to print"))
62 fn is_write_vectored(&self) -> bool {
66 fn flush(&mut self) -> io::Result<()> {
72 pub fn new() -> Stderr {
77 impl io::Write for Stderr {
78 fn write(&mut self, data: &[u8]) -> io::Result<usize> {
81 unsafe { len = abi::write(2, data.as_ptr() as *const u8, data.len()) }
84 Err(io::Error::new(io::ErrorKind::Other, "Stderr is not able to print"))
90 fn write_vectored(&mut self, data: &[IoSlice<'_>]) -> io::Result<usize> {
93 unsafe { len = abi::write(2, data.as_ptr() as *const u8, data.len()) }
96 Err(io::Error::new(io::ErrorKind::Other, "Stderr is not able to print"))
103 fn is_write_vectored(&self) -> bool {
107 fn flush(&mut self) -> io::Result<()> {
112 pub const STDIN_BUF_SIZE: usize = 0;
114 pub fn is_ebadf(_err: &io::Error) -> bool {
118 pub fn panic_output() -> Option<impl io::Write> {