wasm_wit_component library
Wasm Wit Component bindings for Dart
This library contains the types and tools to implement and generate bindings for a Wasm Wit Component.
Classes
- Bool
- Represents a bool value
- Borrow
- CanonicalOptions
- Case
- One of the options within a Variant
- Char
- Represents a unicode character. String in Dart.
- ComponentExternType
- ComponentInstance
- ComponentType
- CoreFuncType
- DespecializedValType
- Bool U8 U16 U32 U64 S8 S16 S32 S64 Float32 Float64 Char StringType ListType RecordType : Tuple Variant : Union, EnumType, OptionType, ResultType Flags Own Borrow
- EnumType
- EnvVariable
-
Err<
O, E> - A Rust-style Result type's failure value.
- ExternalType
- Flags
- FlagsBits
- A class that stores a list of flags as a ByteData instance.
- FlatValue
- Float32
- Represents a Float32 value. double in Dart.
- Float64
- Represents a Float64 value. double in Dart.
- FloatType
- FuncTy
- FuncType
- GlobalTy
- Handle
- Represent handle values referring to resources
- HandleTable
- HandleTable (singular) encapsulates a single mutable, growable array of handles that all share the same ResourceType
- HandleTables
- Simply a wrapper around a mutable mapping from ResourceType to HandleTable
- i64
- Utility static functions for I64 use i64.fromInt or i64.fromBigInt to create use i64.toInt or i64.toBigInt to convert use i64.getInt64, i64.getUint64, i64.setInt64 and i64.setUint64 to read bytes data
- InstanceType
- IntType
- ListType
- MemoryTy
- ModuleConfig
- ModuleConfigWasmi
- ModuleConfigWasmtime
-
None<
T extends Object> - A Rust-style Option type's None value.
- NumType
- ObjectComparator
- Used to compare equality between objects and calculate their hash codes.
-
Ok<
O, E> - A Rust-style Result type's success value.
-
Option<
T extends Object> - A Rust-style Option type.
- OptionType
- Own
- ParsedString
- PreopenedDir
- A preopened directory that the WASM module will be able to access
- RecordType
-
A collection of named fields.
record
in wit and aclass
orMap<String, Object?>
in Dart. - Resource
- ResourceType
- The ResourceType class represents a resource type that has been defined by the specific component instance pointed to by impl with a particular function closure as the dtor.
-
Result<
O, E> - A Rust-style Result type.
- ResultType
- S16
- Represents a signed 16-bit integer. int in Dart.
- S32
- Represents a signed 32-bit integer. int in Dart.
- S64
- Represents a S64 value
- S8
- Represents a signed 8-bit integer. int in Dart.
-
Some<
T extends Object> - A Rust-style Option type's Some value.
- StringType
- Represents a String value. String in Dart.
- TableTy
- ToJsonSerializable
- An interface for values that can be converted to JSON.
- Tuple
-
A collection of values.
tuple
in wit andRecord
or(value1, ...)
in Dart. - U16
- Represents a unsigned 16-bit integer. int in Dart.
- U32
- Represents a unsigned 32-bit integer. int in Dart.
- U64
- Represents a U64 value
- U8
- Represents an unsigned 8-bit integer. int in Dart.
- U8Array16
- Union
- ValType
- A Wasm component value type
- Variant
- A type that can be one of several different Case.
- WasiConfig
- The configuration and arguments for the WASI module.
- WasiDirectory
- A Wasi in-memory directory for the browser executor.
- WasiFd
- A Wasi file system item One of WasiFile or WasiDirectory.
- WasiFile
- A Wasi in-memory file for the browser executor.
- WasiStackLimits
- The configured limits of the Wasm stack.
- WasmExternal
- A WASM external value that can be imported or exported.
- WasmFeatures
- https://docs.wasmtime.dev/stability-wasm-proposals-support.html
- WasmFunction
- A Wasm function.
- WasmGlobal
- A global value that can be read with get and written with set when the global is mutable.
- WasmImport
- A WASM import that can be used in WasmInstanceBuilder.addImports to construct a WasmInstance.
- WasmInstance
- The module instance that was created from a module and can be used to call functions with getFunction or access any of the exports. You can limit the execution of the module with fuel. You may use WasmModule.builder to create a new WasmInstanceBuilder and then WasmInstanceBuilder.build to construct a WasmInstance.
- WasmInstanceBuilder
- Constructs a new WasmInstance from a WasmModule by adding imports with addImport and constructing other WasmExternal values (createMemory, createGlobal or createTable). You may use WasmModule.builder to create a new WasmInstanceBuilder. To instantiate this builder you may use WasmInstanceBuilder.build or WasmInstanceBuilder.build.
- WasmInstanceFuel
- Returns the fuel that can be used to limit the amount of computations performed by the instance.
- WasmLibrary
- A WasmLibrary is a wrapper around a WasmInstance that provides convenience methods for interacting with the instance that implements the WASM component model.
- WasmMemory
- A linear memory (array of bytes) that can be used to share data with the WASM module.
- WasmModule
- A compiled WASM module. You may introspect it by using getImports and getExports. You may use builder to create a WasmInstance from it to execute it or use its exports.
- WasmModuleExport
- WasmModule exports entry.
- WasmModuleImport
- WasmModule import entry.
- WasmRunLibrary
- Static namespace for configuring the dynamic library for wasm_run
- WasmRuntimeFeatures
- A linear memory (array of bytes) that can be used to share data with the WASM module. This memory can be shared between multiple instances of the same module in different threads.
- WasmTable
- A Table that can be used to store object references and functions.
- WasmValue
- A WASM value.
- WasmValueRef
- A WASM reference value.
- WasmWasiFeatures
- https://docs.wasmtime.dev/stability-wasi-proposals-support.html
- WorkersConfig
- Configuration for spawning workers.
Enums
- FlatType
- Int64TypeConfig
- Configures how 64 bit integers are represented in the generated code.
-
Result of
SharedMemory.atomicWait32
andSharedMemory.atomicWait64
- StringEncoding
-
The encoding used to
load_string
andstore_string
from wasm memory. - ValueTy
- WasmExternalKind
- Possible kinds of import or export entries.
Properties
- comparator ↔ ObjectComparator
-
The ObjectComparator used to compare equality between objects
and calculate their hash codes.
getter/setter pair
- unreachableException → Exception
-
An exception thrown when a the execution flow should never have
reached a certain point.
final
Functions
-
bigIntFromJson(
Object? value) → BigInt -
Returns a BigInt from a JSON
value
. -
canon_lift(
CanonicalOptions opts, ComponentInstance inst, List< FlatValue> callee(List<FlatValue> ), FuncType ft, ListValue args, {ComputedFuncTypeData? computedFt}) → (ListValue, void Function()) - Using the above supporting definitions, we can describe the static and dynamic semantics of component-level canon definitions. The following subsections cover each of these canon cases. For a canonical definition:
-
canon_lift_async(
CanonicalOptions opts, ComponentInstance inst, Future< List< callee(List<FlatValue> >FlatValue> ), FuncType ft, ListValue args, {ComputedFuncTypeData? computedFt}) → Future<(ListValue, void Function())> -
canon_lower(
CanonicalOptions opts, ComponentInstance inst, (ListValue, void Function()) callee(ListValue), bool calling_import, FuncType ft, List< FlatValue> flat_args, {ComputedFuncTypeData? computedFt}) → List<FlatValue> - For a canonical definition:
-
canon_resource_drop(
ComponentInstance inst, ResourceType rt, int i) → void -
canon_resource_new(
ComponentInstance inst, ResourceType rt, int rep) → int -
canon_resource_rep(
ComponentInstance inst, ResourceType rt, int i) → int -
compileWasmModule(
Uint8List bytes, {ModuleConfig? config}) → Future< WasmModule> - Compiles a Wasm module asynchronously.
-
compileWasmModuleSync(
Uint8List bytes, {ModuleConfig? config}) → WasmModule - Compiles a Wasm module synchronously. You should use compileWasmModule, unless the module is small.
-
discriminant_type(
List< Case> cases) → IntType -
flagBitsFromJson(
Object? json_, Flags spec) → ByteData - Converts a JSON object to a ByteData containing the flag bits.
-
loweredImportFunction(
String name, FuncType ft, CanonLowerCallee execFn, WasmLibrary getWasmLibrary()) → WasmFunction -
Creates a core WasmFunction from a component CanonLowerCallee function
by lowering it with canon_lower for the given
ft
(FuncType). -
max_case_alignment(
List< Case> cases) → int -
num_i32_flags(
List< String> labels) → int -
resourceImports(
WasmLibrary getWasmLibrary(), ResourceType rt) → List< WasmImport> -
size_flags(
List< String> labels) → int -
wasmRuntimeFeatures(
) → Future< WasmRuntimeFeatures> - Information of the Wasm Runtime. Contains the default and supported WasmFeatures used when compiling a WASM module, the name of the runtime, it's version and whether it is the browser's runtime or not.
Typedefs
- CanonLowerCallee = (ListValue, void Function()) Function(ListValue args)
- ExternDecl = ({String name, ComponentExternType t})
- Field = ({String label, ValType t})
- I64 = Object
-
int for dart:io, Js
BigInt
for dart:html Utility static functions in: i64. use i64.fromInt or i64.fromBigInt to create use i64.toInt or i64.toBigInt to convert use i64.getInt64, i64.getUint64, i64.setInt64 and i64.setUint64 to read bytes data -
ListValue
= List<
Object?>
Exceptions / Errors
-
ResultException<
O, E> - An exception that wraps inner, a Result
- Trap
- An exception thrown during wasm execution or loading