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 ofwasmorwat. -
aot_file- The generated AOT wasm file, of which the file extension should bedylibon macOS,soon Linux ordllon 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 bedylibon macOS,soon Linux ordllon 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.