this is indeed a nice way to do refs!

This commit is contained in:
Pat Hickey
2021-01-13 15:11:11 -08:00
parent 7beb52a2bc
commit ea94d6f79d
3 changed files with 169 additions and 128 deletions

View File

@@ -83,6 +83,15 @@ pub struct Filestat {
pub ctim: Option<std::time::SystemTime>,
}
pub(crate) trait TableFileExt {
fn get_file(&self, fd: u32) -> Result<Ref<FileEntry>, Error>;
}
impl TableFileExt for crate::table::Table {
fn get_file(&self, fd: u32) -> Result<Ref<FileEntry>, Error> {
self.get(fd)
}
}
pub(crate) struct FileEntry {
caps: FileCaps,
file: Box<dyn WasiFile>,