We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c77e370 commit f0764b1Copy full SHA for f0764b1
library/std/src/sys/pal/zkvm/stdio.rs
@@ -1,6 +1,6 @@
1
use super::abi;
2
use super::abi::fileno;
3
-use crate::io;
+use crate::io::{self, BorrowedCursor};
4
5
pub struct Stdin;
6
pub struct Stdout;
@@ -16,6 +16,14 @@ impl io::Read for Stdin {
16
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
17
Ok(unsafe { abi::sys_read(fileno::STDIN, buf.as_mut_ptr(), buf.len()) })
18
}
19
+
20
+ fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> {
21
+ unsafe {
22
+ let n = abi::sys_read(fileno::STDIN, buf.as_mut().as_mut_ptr().cast(), buf.capacity());
23
+ buf.advance_unchecked(n);
24
+ }
25
+ Ok(())
26
27
28
29
impl Stdout {
0 commit comments