wasmrs_host/
wasi.rs

1use std::path::PathBuf;
2
3/// Parameters defining the options for enabling WASI on a module (if applicable)
4#[derive(Debug, Default, Clone, Eq, PartialEq)]
5#[must_use]
6pub struct WasiParams {
7  /// Command line arguments to expose to WASI.
8  pub argv: Vec<String>,
9  /// A mapping of directories.
10  pub map_dirs: Vec<(String, PathBuf)>,
11  /// Environment variables and values to expose.
12  pub env_vars: Vec<(String, String)>,
13  /// Directories that WASI has access to.
14  pub preopened_dirs: Vec<PathBuf>,
15}
16
17impl WasiParams {
18  /// Instantiate a new WasiParams struct.
19  pub fn new(
20    argv: Vec<String>,
21    map_dirs: Vec<(String, PathBuf)>,
22    env_vars: Vec<(String, String)>,
23    preopened_dirs: Vec<PathBuf>,
24  ) -> Self {
25    WasiParams {
26      argv,
27      map_dirs,
28      preopened_dirs,
29      env_vars,
30    }
31  }
32}