Skip to content

Commit 284bddc

Browse files
committed
feat(fs): add writev & readv to stdio
1 parent 2d8d2a9 commit 284bddc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

compio-fs/src/stdio/unix.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{io, mem::ManuallyDrop};
22

3-
use compio_buf::{BufResult, IoBuf, IoBufMut};
3+
use compio_buf::{BufResult, IoBuf, IoBufMut, IoVectoredBuf, IoVectoredBufMut};
44
use compio_driver::{FromRawFd, RawFd};
55
use compio_io::{AsyncRead, AsyncWrite};
66
use compio_runtime::TryAsRawFd;
@@ -25,6 +25,10 @@ impl AsyncRead for Stdin {
2525
async fn read<B: IoBufMut>(&mut self, buf: B) -> BufResult<usize, B> {
2626
self.0.read(buf).await
2727
}
28+
29+
async fn read_vectored<V: IoVectoredBufMut>(&mut self, buf: V) -> BufResult<usize, V> {
30+
self.0.read_vectored(buf).await
31+
}
2832
}
2933

3034
impl TryAsRawFd for Stdin {
@@ -56,6 +60,10 @@ impl AsyncWrite for Stdout {
5660
self.0.write(buf).await
5761
}
5862

63+
async fn write_vectored<T: IoVectoredBuf>(&mut self, buf: T) -> BufResult<usize, T> {
64+
self.0.write_vectored(buf).await
65+
}
66+
5967
async fn flush(&mut self) -> io::Result<()> {
6068
self.0.flush().await
6169
}
@@ -94,6 +102,10 @@ impl AsyncWrite for Stderr {
94102
self.0.write(buf).await
95103
}
96104

105+
async fn write_vectored<T: IoVectoredBuf>(&mut self, buf: T) -> BufResult<usize, T> {
106+
self.0.write_vectored(buf).await
107+
}
108+
97109
async fn flush(&mut self) -> io::Result<()> {
98110
self.0.flush().await
99111
}

0 commit comments

Comments
 (0)