Move extracting fds from context into hostcalls
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user