Wasmtime: C++
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Public Member Functions | List of all members
wasmtime::WasiConfig Class Reference

Configuration for an instance of WASI. More...

#include <wasmtime.hh>

Public Member Functions

 WasiConfig ()
 Creates a new configuration object with default settings.
 
void argv (const std::vector< std::string > &args)
 Configures the argv explicitly with the given string array.
 
void inherit_argv ()
 Configures the argv for wasm to be inherited from this process itself.
 
void env (const std::vector< std::pair< std::string, std::string > > &env)
 
void inherit_env ()
 
bool stdin_file (const std::string &path)
 
void inherit_stdin ()
 
bool stdout_file (const std::string &path)
 
void inherit_stdout ()
 
bool stderr_file (const std::string &path)
 
void inherit_stderr ()
 
bool preopen_dir (const std::string &path, const std::string &guest_path, size_t dir_perms, size_t file_perms)
 Opens path to be opened as guest_path in the WASI pseudo-filesystem.
 

Detailed Description

Configuration for an instance of WASI.

This is inserted into a store with Store::Context::set_wasi.

Examples
linking.cc.

Member Function Documentation

◆ env()

void wasmtime::WasiConfig::env ( const std::vector< std::pair< std::string, std::string > > &  env)
inline

Configures the environment variables available to wasm, specified here as a list of pairs where the first element of the pair is the key and the second element is the value.

◆ inherit_env()

void wasmtime::WasiConfig::inherit_env ( )
inline

Indicates that the entire environment of this process should be inherited by the wasi configuration.

Examples
linking.cc.

◆ inherit_stderr()

void wasmtime::WasiConfig::inherit_stderr ( )
inline

Configures this WASI configuration to inherit its stdout from the host process.

Examples
linking.cc.

◆ inherit_stdin()

void wasmtime::WasiConfig::inherit_stdin ( )
inline

Configures this WASI configuration to inherit its stdin from the host process.

Examples
linking.cc.

◆ inherit_stdout()

void wasmtime::WasiConfig::inherit_stdout ( )
inline

Configures this WASI configuration to inherit its stdout from the host process.

Examples
linking.cc.

◆ stderr_file()

bool wasmtime::WasiConfig::stderr_file ( const std::string &  path)
inline

Configures the provided file to be created and all stderr output will be written there.

◆ stdin_file()

bool wasmtime::WasiConfig::stdin_file ( const std::string &  path)
inline

Configures the provided file to be used for the stdin of this WASI configuration.

◆ stdout_file()

bool wasmtime::WasiConfig::stdout_file ( const std::string &  path)
inline

Configures the provided file to be created and all stdout output will be written there.


The documentation for this class was generated from the following file: