wasm_interp: support fake files in WASI

This commit is contained in:
Brian Carroll 2022-12-16 10:33:37 +00:00
parent 09fee71084
commit 3ef171e620
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
2 changed files with 57 additions and 27 deletions

View file

@ -8,7 +8,6 @@ pub mod wasi;
pub use instance::Instance;
pub use wasi::WasiDispatcher;
use rand::prelude::*;
use roc_wasm_module::{Value, ValueType, WasmModule};
use value_stack::ValueStack;
@ -26,10 +25,7 @@ pub trait ImportDispatcher {
impl Default for DefaultImportDispatcher<'_> {
fn default() -> Self {
DefaultImportDispatcher {
wasi: WasiDispatcher {
args: &[],
rng: thread_rng(),
},
wasi: WasiDispatcher::new(&[]),
}
}
}
@ -41,10 +37,7 @@ pub struct DefaultImportDispatcher<'a> {
impl<'a> DefaultImportDispatcher<'a> {
pub fn new(args: &'a [&'a [u8]]) -> Self {
DefaultImportDispatcher {
wasi: WasiDispatcher {
args,
rng: thread_rng(),
},
wasi: WasiDispatcher::new(args),
}
}
}