Package org.apache.ignite.compute.wasm
Enum Class WasmCallingConvention
- All Implemented Interfaces:
Serializable,Comparable<WasmCallingConvention>,Constable
WebAssembly calling conventions.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionGeneric calling convention.Go-specific calling convention that works with modules built usingGOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared.Rust-specific calling convention that works with modules built usingwasm-packandwasm-bindgen. -
Method Summary
Modifier and TypeMethodDescriptionstatic WasmCallingConventionReturns the enum constant of this class with the specified name.static WasmCallingConvention[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
GENERIC
Generic calling convention. Aims to be language-agnostic.- Calls
_startand/or__wasm_call_ctorsfor module initialization (if present). - Requires
allocanddeallocexports for memory management.
- Calls
-
RUST_WASM_BINDGEN
Rust-specific calling convention that works with modules built usingwasm-packandwasm-bindgen.To build a compatible module:
cargo install wasm-packcargo new --lib hello-wasm- Add the following to
Cargo.toml:[lib] crate-type = ["cdylib"] [dependencies] wasm-bindgen = "0.2"
- Add the following to
src/lib.rs:use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn hello(arg: String) -> String { format!("Hello from Rust, {}!", arg) } - Build the module:
wasm-pack build - Use the generated
pkg/hello_wasm_bg.wasmfile as the compute module.
-
GO_WASI_REACTOR
Go-specific calling convention that works with modules built usingGOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared.To build a compatible module:
- In Go code, use
//go:wasmexportto mark functions for export:package main func main() { } //go:wasmexport addOne func addOne(x int32) int32 { return x + 1 } - Build the module:
GOOS=wasip1 GOARCH=wasm go build -o addone.wasm -buildmode=c-shared - Use the generated
addone.wasmfile as the compute module.
- In Go code, use
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-