Struct wasmedge_sys::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 create(config: Option<&Config>) -> WasmEdgeResult<Self>
pub fn create(config: Option<&Config>) -> WasmEdgeResult<Self>
sourcepub fn compile_from_file(
&self,
wasm_file: impl AsRef<Path>,
aot_file: impl AsRef<Path>
) -> WasmEdgeResult<()>
pub fn compile_from_file( &self, wasm_file: impl AsRef<Path>, aot_file: impl AsRef<Path> ) -> WasmEdgeResult<()>
Compiles the input WASM from the given file path for the AOT mode and stores the result to the output file path.
Arguments
-
wasm_file
- The input wasm file, of which the file extension should be one ofwasm
orwat
. -
aot_file
- The generated AOT wasm file, of which the file extension should bedylib
on macOS,so
on Linux ordll
on Windows.
Error
If fail to compile, then an error is returned.
sourcepub fn compile_from_bytes(
&self,
wasm_bytes: impl AsRef<[u8]>,
aot_file: impl AsRef<Path>
) -> WasmEdgeResult<()>
pub fn compile_from_bytes( &self, wasm_bytes: impl AsRef<[u8]>, aot_file: impl AsRef<Path> ) -> WasmEdgeResult<()>
Compiles the input WASM from the given bytes for the AOT mode and stores the result to the output file path.
Argument
-
wasm_bytes
- The in-memory WASM bytes. -
aot_file
- The generated AOT wasm file, of which the file extension should bedylib
on macOS,so
on Linux ordll
on Windows.
Error
If fail to compile, then an error is returned.
sourcepub fn as_ptr(&self) -> *const WasmEdge_CompilerContext
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_CompilerContext
ffi
only.Provides a raw pointer to the inner Compiler context.