feat(wasi): provide default implementations for WasiFile (#3904)

Additionally, as cleanup, remove duplicate implementations.
This commit is contained in:
Nathaniel McCallum
2022-03-09 17:38:10 -05:00
committed by GitHub
parent ae4d86804d
commit 44a435a43a
6 changed files with 99 additions and 435 deletions

View File

@@ -187,12 +187,6 @@ macro_rules! wasi_file_impl {
Err(e) => Err(e.into()),
}
}
#[cfg(windows)]
async fn readable(&self) -> Result<(), Error> {
// Windows uses a rawfd based scheduler :(
use wasi_common::ErrorExt;
Err(Error::badf())
}
#[cfg(not(windows))]
async fn writable(&self) -> Result<(), Error> {
@@ -217,12 +211,6 @@ macro_rules! wasi_file_impl {
Err(e) => Err(e.into()),
}
}
#[cfg(windows)]
async fn writable(&self) -> Result<(), Error> {
// Windows uses a rawfd based scheduler :(
use wasi_common::ErrorExt;
Err(Error::badf())
}
async fn sock_accept(&mut self, fdflags: FdFlags) -> Result<Box<dyn WasiFile>, Error> {
block_on_dummy_executor(|| self.0.sock_accept(fdflags))