add readable and writable futures to WasiFile trait

This commit is contained in:
Pat Hickey
2021-04-26 14:43:16 -07:00
parent fa44ec2da2
commit b307dce2ab
5 changed files with 39 additions and 0 deletions

View File

@@ -119,6 +119,12 @@ impl WasiFile for File {
async fn num_ready_bytes(&self) -> Result<u64, Error> {
Ok(self.0.num_ready_bytes()?)
}
async fn readable(&mut self) -> Result<(), Error> {
Err(Error::badf())
}
async fn writable(&mut self) -> Result<(), Error> {
Err(Error::badf())
}
}
pub fn filetype_from(ft: &cap_std::fs::FileType) -> FileType {

View File

@@ -103,6 +103,12 @@ impl WasiFile for Stdin {
async fn num_ready_bytes(&self) -> Result<u64, Error> {
Ok(self.0.num_ready_bytes()?)
}
async fn readable(&mut self) -> Result<(), Error> {
Err(Error::badf())
}
async fn writable(&mut self) -> Result<(), Error> {
Err(Error::badf())
}
}
#[cfg(windows)]
impl AsRawHandle for Stdin {
@@ -203,6 +209,12 @@ macro_rules! wasi_file_write_impl {
async fn num_ready_bytes(&self) -> Result<u64, Error> {
Ok(0)
}
async fn readable(&mut self) -> Result<(), Error> {
Err(Error::badf())
}
async fn writable(&mut self) -> Result<(), Error> {
Err(Error::badf())
}
}
#[cfg(windows)]
impl AsRawHandle for $ty {