Skip to content

Commit 39ec658

Browse files
committed
Provide read_buf and vectored read/write for unsupported stdio
1 parent f772f84 commit 39ec658

File tree

1 file changed

+32
-1
lines changed
  • library/std/src/sys/pal/unsupported

1 file changed

+32
-1
lines changed

library/std/src/sys/pal/unsupported/stdio.rs

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::io;
1+
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
22

33
pub struct Stdin;
44
pub struct Stdout;
@@ -14,6 +14,19 @@ impl io::Read for Stdin {
1414
fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
1515
Ok(0)
1616
}
17+
18+
fn read_buf(&mut self, _buf: BorrowedCursor<'_>) -> io::Result<()> {
19+
Ok(())
20+
}
21+
22+
fn read_vectored(&mut self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
23+
Ok(0)
24+
}
25+
26+
#[inline]
27+
fn is_read_vectored(&self) -> bool {
28+
true
29+
}
1730
}
1831

1932
impl Stdout {
@@ -30,6 +43,15 @@ impl io::Write for Stdout {
3043
fn flush(&mut self) -> io::Result<()> {
3144
Ok(())
3245
}
46+
47+
fn write_vectored(&mut self, _bufs: &[IoSlice<'_>]) -> io::Result<usize> {
48+
Ok(0)
49+
}
50+
51+
#[inline]
52+
fn is_write_vectored(&self) -> bool {
53+
true
54+
}
3355
}
3456

3557
impl Stderr {
@@ -46,6 +68,15 @@ impl io::Write for Stderr {
4668
fn flush(&mut self) -> io::Result<()> {
4769
Ok(())
4870
}
71+
72+
fn write_vectored(&mut self, _bufs: &[IoSlice<'_>]) -> io::Result<usize> {
73+
Ok(0)
74+
}
75+
76+
#[inline]
77+
fn is_write_vectored(&self) -> bool {
78+
true
79+
}
4980
}
5081

5182
pub const STDIN_BUF_SIZE: usize = 0;

0 commit comments

Comments
 (0)