I want to use some types which are used by wasi in my code which is added to wasmtime-cli (run.rs file). For doing that, so I added wasi-common crate to dependencies. And then I imported types using the below line:
wasi_common::snapshots::preview_1::types::*;
But I still got errors when I want to use some types. For example, for Fd, I used the similar code in fd_write function and use wasi in Host struct as WasiCtx.
let fd_val: u32 = i1.try_into().unwrap();
let new_fd=Fd::from(fd_val);
let f = name
.table()
.get_file_mut(fd_val)?
.get_cap_mut(FileCaps::WRITE)?;
}
It says:
no method named `get_file_mut` found for mutable reference `&mut wasi_common::Table` in the current scope. --> src/commands/run.rs:258:14
Can you please help me with that?
(Sorry I just started to work on wasmtime and wasi)
get_file_mut
is a crate-private method. I'm not sure that what you are trying to do is actually possible with the current public interface.
We could make that method public if it solves your problem. Feel free to send a PR and mark me as the reviewer
@Pat Hickey Oh that would be great! right now, I changed my plan for implementation, will do if I decide to use this way.
Last updated: Dec 23 2024 at 13:07 UTC