Kwasm.api
package kwasm.api
Classes
Name | Description |
---|---|
interface HostFunction
|
Base for all host-provided functions exposed to WebAssembly programs via imports. |
interface HostFunctionContext
|
Additional context passed to a HostFunction at invocation-time. |
interface MemoryProvider
|
KWasm users can implement MemoryProvider to customize the instances of Memory which are provided to WebAssembly modules running in KWasm. |
open class ByteBufferMemoryProvider
|
Implementation of MemoryProvider which builds blank ByteBufferMemory memories. |
Methods
UnitHostFunction
fun UnitHostFunction(block: (HostFunctionContext)->Unit): HostFunction<EmptyValue>
Parameters
Name | Description |
---|---|
block: (HostFunctionContext)->Unit
|
ReturnValue
Name | Description |
---|---|
HostFunction<EmptyValue>
|
UnitHostFunction
inline fun <P1 : Value<*>> UnitHostFunction(noinline block: (P1, HostFunctionContext)->Unit): HostFunction<EmptyValue>
Creates a HostFunction which accepts a single parameter (P1) and returns no value. (ie. Unit)
Parameters
Name | Description |
---|---|
noinline block: (P1, HostFunctionContext)->Unit
|
ReturnValue
Name | Description |
---|---|
HostFunction<EmptyValue>
|
UnitHostFunction
inline fun <P1 : Value<*>, P2 : Value<*>> UnitHostFunction(noinline block: (P1, P2, HostFunctionContext)->Unit): HostFunction<EmptyValue>
Creates a HostFunction which accepts two parameters (P1 and P2) and returns no value. (ie. Unit)
Parameters
Name | Description |
---|---|
noinline block: (P1, P2, HostFunctionContext)->Unit
|
ReturnValue
Name | Description |
---|---|
HostFunction<EmptyValue>
|
UnitHostFunction
inline fun <P1 : Value<*>, P2 : Value<*>, P3 : Value<*>> UnitHostFunction(noinline block: (P1, P2, P3, HostFunctionContext)->Unit): HostFunction<EmptyValue>
Creates a HostFunction which accepts three parameters (P1, P2, and P3) and returns no value. (ie. Unit)
Parameters
Name | Description |
---|---|
noinline block: (P1, P2, P3, HostFunctionContext)->Unit
|
ReturnValue
Name | Description |
---|---|
HostFunction<EmptyValue>
|
HostFunction
inline fun <ReturnType : Value<*>> HostFunction(crossinline block: (HostFunctionContext)->ReturnType): HostFunction<ReturnType>
Creates a HostFunction which accepts no parameters and returns a value of type ReturnType.
Parameters
Name | Description |
---|---|
crossinline block: (HostFunctionContext)->ReturnType
|
ReturnValue
Name | Description |
---|---|
HostFunction<ReturnType>
|
HostFunction
inline fun <P1 : Value<*>, ReturnType : Value<*>> HostFunction(crossinline block: (P1, HostFunctionContext)->ReturnType): HostFunction<ReturnType>
Creates a HostFunction which accepts a single parameter (P1) and returns a value of type ReturnType.
Parameters
Name | Description |
---|---|
crossinline block: (P1, HostFunctionContext)->ReturnType
|
ReturnValue
Name | Description |
---|---|
HostFunction<ReturnType>
|
HostFunction
inline fun <P1 : Value<*>, P2 : Value<*>, ReturnType : Value<*>> HostFunction(crossinline block: (P1, P2, HostFunctionContext)->ReturnType): HostFunction<ReturnType>
Creates a HostFunction which accepts two parameters (P1 and P2) and returns a value of type ReturnType.
Parameters
Name | Description |
---|---|
crossinline block: (P1, P2, HostFunctionContext)->ReturnType
|
ReturnValue
Name | Description |
---|---|
HostFunction<ReturnType>
|
HostFunction
inline fun <P1 : Value<*>, P2 : Value<*>, P3 : Value<*>, ReturnType : Value<*>> HostFunction(crossinline block: (P1, P2, P3, HostFunctionContext)->ReturnType): HostFunction<ReturnType>
Creates a HostFunction which accepts three parameters (P1, P2, and P3) and returns a value of type ReturnType.
Parameters
Name | Description |
---|---|
crossinline block: (P1, P2, P3, HostFunctionContext)->ReturnType
|
ReturnValue
Name | Description |
---|---|
HostFunction<ReturnType>
|
Creates a HostFunction which accepts no parameters and returns no value. (ie. Unit)