feat(wasm-backend, app-service)!: use String for wasi env vars + require Clone for Function trait (#333)

* use String instead of Vec<u8> for wasi envs

* require Clone for Function trait

* fmt

* pr fixes
This commit is contained in:
Valery Antopol
2023-06-14 17:47:14 +03:00
committed by GitHub
parent 1e6dc4aca6
commit aeae703229
9 changed files with 23 additions and 45 deletions

View File

@ -21,6 +21,7 @@ use crate::DelayedContextLifetime;
use crate::WasmBackend;
/// Contains Wasm exports necessary for internal usage.
#[derive(Clone)]
pub enum Export<WB: WasmBackend> {
Memory(<WB as WasmBackend>::Memory),
Function(<WB as WasmBackend>::Function),

View File

@ -23,7 +23,7 @@ use crate::WValue;
/// A Wasm function handle, it can be either a function from a host or an export from an `Instance`.
/// As it is only a handle to an object in `Store`, cloning is cheap
pub trait Function<WB: WasmBackend>: Send + Sync {
pub trait Function<WB: WasmBackend>: Send + Sync + Clone {
/// Creates a new function with dynamic signature.
/// The signature check is performed at runtime.
fn new<F>(store: &mut impl AsContextMut<WB>, sig: FuncSig, func: F) -> Self

View File

@ -41,8 +41,8 @@ pub trait WasiImplementation<WB: WasmBackend> {
#[derive(Default)]
pub struct WasiParameters {
pub args: Vec<Vec<u8>>,
pub envs: HashMap<Vec<u8>, Vec<u8>>,
pub args: Vec<String>,
pub envs: HashMap<String, String>,
pub preopened_files: HashSet<PathBuf>,
pub mapped_dirs: HashMap<String, PathBuf>,
}