Move extracting fds from context into hostcalls

This commit is contained in:
Jakub Konka
2019-07-20 10:38:21 +02:00
committed by Dan Gohman
parent 14391bab56
commit 0d571a4e6d
6 changed files with 301 additions and 361 deletions

View File

@@ -14,6 +14,13 @@ pub enum Descriptor {
}
impl Descriptor {
pub fn as_file(&self) -> Result<&fs::File> {
match self {
Descriptor::File(f) => Ok(f),
_ => Err(host::__WASI_EBADF),
}
}
pub fn is_file(&self) -> bool {
match self {
Descriptor::File(_) => true,