Struct wasmedge_sdk::Compiler
source · pub struct Compiler { /* private fields */ }
aot
only.Expand description
Defines WasmEdge ahead-of-time(AOT) compiler and the relevant APIs.
Implementations§
source§impl Compiler
impl Compiler
sourcepub fn new(config: Option<&Config>) -> WasmEdgeResult<Self>
pub fn new(config: Option<&Config>) -> WasmEdgeResult<Self>
sourcepub fn compile_from_file(
&self,
wasm_file: impl AsRef<Path>,
filename: impl AsRef<str>,
out_dir: impl AsRef<Path>
) -> WasmEdgeResult<PathBuf>
pub fn compile_from_file( &self, wasm_file: impl AsRef<Path>, filename: impl AsRef<str>, out_dir: impl AsRef<Path> ) -> WasmEdgeResult<PathBuf>
Compiles the given wasm file into a shared library file (*.so in Linux, *.dylib in macOS, or *.dll in Windows). The file path of the generated shared library file will be returned if the method works successfully.
Arguments
-
wasm_file
- The target wasm file. -
filename
- The filename of the generated shared library file. -
out_dir
- The target directory to save the generated shared library file.
Error
If fail to compile, then an error is returned.
sourcepub fn compile_from_bytes(
&self,
bytes: impl AsRef<[u8]>,
filename: impl AsRef<str>,
out_dir: impl AsRef<Path>
) -> WasmEdgeResult<PathBuf>
pub fn compile_from_bytes( &self, bytes: impl AsRef<[u8]>, filename: impl AsRef<str>, out_dir: impl AsRef<Path> ) -> WasmEdgeResult<PathBuf>
Compiles the given wasm bytes into a shared library file (*.so in Linux, *.dylib in macOS, or *.dll in Windows). The file path of the generated shared library file will be returned if the method works successfully.
Argument
-
bytes
- A in-memory WASM bytes. -
filename
- The filename of the generated shared library file. -
out_dir
- The target directory to save the generated shared library file.
Error
If fail to compile, then an error is returned.