Documentation
¶
Overview ¶
Package component runs WebAssembly Component Model components -- and the WASI 0.2 (wasip2) world built on it -- on a wazy Runtime.
Where the core wazy package instantiates core modules, this package instantiates *components*: genuine wasm32-wasip2 binaries produced by rustc, wasm-tools, and friends. It decodes the component, wires its multi-module graph (nested instances, canonical lift/lower of the Canonical ABI, resource lifetimes), and -- with WithWASI -- provides the WASI 0.2 host interfaces (wasi:cli, clocks, filesystem, io, random, sockets, http).
Typical use: build a Runtime, instantiate a component with the WASI surface wired to your stdio/filesystem/args, call an export, then Close.
r := wazy.NewRuntime(ctx)
defer r.Close(ctx)
inst, err := component.Instantiate(ctx, r, componentWasm,
component.WithWASI(component.WASIConfig{Stdout: os.Stdout})...)
if err != nil {
return err
}
defer inst.Close(ctx)
// A wasi:cli/command component: run its entry point.
_, err = inst.Call(ctx, "wasi:cli/run@0.2.3#run")
Call arguments and results are Go values (uint32, int64, string, []any for lists/records, and uint32 handles for resources), matching the Canonical ABI's lifting of the component's WIT types.
This API is young and, like the rest of wazy, makes no stability promise yet.
Index ¶
- Constants
- func ListOf[T any](v Value) ([]T, error)
- func MapOf[K comparable, V any](v Value) (map[K]V, error)
- type AsyncCall
- type AsyncHostFunc
- type BorrowDesc
- type CompileCache
- type CopyResult
- type EnumDesc
- type ErrorContext
- type FixedListDesc
- type FlagsDesc
- type FuncDesc
- type FuncParam
- type FuncResult
- type FuncResults
- type FutureDesc
- type FutureReader
- type FutureWriter
- type HandleTable
- type HostFunc
- type Instance
- type ListDesc
- type MapDesc
- type Option
- func WithAsyncImport(iface, name string, fn AsyncHostFunc, params, results []TypeDesc) Option
- func WithAsyncImportCustom(iface, name string, fn AsyncHostFunc, fd FuncDesc, resolve Resolver) Option
- func WithCompileCache(cache *CompileCache) Option
- func WithComponentImport(name string, componentBytes []byte) Option
- func WithHostResourceDtor(tag uint32, fn func(ctx context.Context, rep uint32) error) Option
- func WithHostState(key, value any) Option
- func WithImport(iface, name string, fn HostFunc, params, results []TypeDesc) Option
- func WithImportCustom(iface, name string, fn HostFunc, fd FuncDesc, resolve Resolver) Option
- func WithResourceTag(iface, name string, tag uint32) Option
- func WithResourcesHook(hook func(*HandleTable)) Option
- type OptionDesc
- type OwnDesc
- type PendingCall
- type PrimitiveDesc
- type RecordDesc
- type RecordField
- type Resolver
- type ResultDesc
- type ResultValue
- type Some
- type StreamDesc
- type StreamReader
- type StreamWriter
- type TupleDesc
- type TypeDesc
- type TypeRef
- type TypeTable
- func (t *TypeTable) Add(td TypeDesc) TypeRef
- func (t *TypeTable) Borrow(tag uint32) TypeRef
- func (t *TypeTable) Enum(cases ...string) TypeRef
- func (t *TypeTable) FixedList(elem TypeRef, n uint32) TypeRef
- func (t *TypeTable) Flags(names ...string) TypeRef
- func (t *TypeTable) Func(params []TypeRef, result TypeRef) FuncDesc
- func (t *TypeTable) Future(elem TypeRef) TypeRef
- func (t *TypeTable) List(elem TypeRef) TypeRef
- func (t *TypeTable) Map(key, value TypeRef) TypeRef
- func (t *TypeTable) Option(elem TypeRef) TypeRef
- func (t *TypeTable) Own(tag uint32) TypeRef
- func (t *TypeTable) Record(nameTypePairs ...any) TypeRef
- func (t *TypeTable) Resolver() Resolver
- func (t *TypeTable) Result(ok, err TypeRef) TypeRef
- func (t *TypeTable) Stream(elem TypeRef) TypeRef
- func (t *TypeTable) Tuple(elems ...TypeRef) TypeRef
- func (t *TypeTable) Variant(cases ...VariantCaseSpec) TypeRef
- type Value
- type VariantCase
- type VariantCaseSpec
- type VariantDesc
- type VariantValue
Constants ¶
const ( // CopyCompleted is a copy that transferred what it could. CopyCompleted = instance.CopyCompleted // CopyDropped is a copy whose other end was dropped: the stream is done. CopyDropped = instance.CopyDropped // CopyCancelled is a copy revoked by Cancel. CopyCancelled = instance.CopyCancelled )
Variables ¶
This section is empty.
Functions ¶
func ListOf ¶ added in v0.2.0
ListOf returns a list Value as a []T.
A list of a fixed-width primitive lifts to the Go slice of that primitive (see ListDesc), so a host function reading one can take it directly. Lists of anything else -- strings, records, nested lists -- lift as []Value, and a caller wanting []string or []MyRecord has to walk them. ListOf does both:
names, err := component.ListOf[string](args[0]) // list<string> sizes, err := component.ListOf[uint32](args[1]) // list<u32>
The typed shape costs nothing -- it is returned as it arrived, not copied -- so this is not a slow compatibility wrapper for the case it was written for.
A fixed-length list<T, N> has the same two shapes, so ListOf reads it too.
It also accepts the []Value shape for a scalar list, which is what a host function written before lists were typed will have been asserting, and what a caller building one by hand still produces. Converting between the two is what the slower path does, element by element.
An element that is not a T, and cannot be converted to one, is an error naming its index: a list is not a place to guess.
func MapOf ¶ added in v0.4.0
func MapOf[K comparable, V any](v Value) (map[K]V, error)
MapOf returns a map Value as a Go map[K]V.
A map<K,V> lifts as a []Value of two-element []Value{key, value} pairs -- the same shape list<tuple<K,V>> lifts to, since a map has no Canonical ABI representation of its own (see MapDesc). MapOf walks that shape and builds the Go map a host function actually wants to index:
counts, err := component.MapOf[string, uint32](args[0]) // map<string, u32>
A key or value that is not a K/V and cannot be converted to one (the same widened-scalar case ListOf handles, e.g. a u16 value arriving as uint32) is an error naming the offending entry.
map<K, option<V>> is read by instantiating K or V as a pointer: MapOf[string, *uint32] on a map<string, option<u32>> gives a nil *uint32 for an entry whose value is none and a pointer to the lifted value otherwise.
Duplicate keys in the backing list are collapsed in the resulting map. The value for the last key is preserved.
Types ¶
type AsyncCall ¶
AsyncCall is the completion handle an AsyncHostFunc receives. Call Resolve with the import's results (or ResolveCancelled). Under CallAsync, Resolve may be called from another goroutine after the AsyncHostFunc returns -- that is how external I/O completions drive a component forward.
type AsyncHostFunc ¶
type AsyncHostFunc = instance.AsyncHostFunc
AsyncHostFunc implements an async-lowered component import. It receives the lifted arguments and an *AsyncCall used to deliver the result -- synchronously (call.Resolve before returning) or later, from any goroutine, once the call was started via Instance.CallAsync. Register it with WithAsyncImport.
type BorrowDesc ¶
type BorrowDesc = binary.BorrowDesc
BorrowDesc is borrow<R> -- a handle lent for the duration of the call.
type CompileCache ¶
type CompileCache = instance.CompileCache
CompileCache amortizes a component's decode and its embedded core modules' compilation across repeated Instantiate calls of the same component bytes. Safe for concurrent use. Pair one with a single Runtime and Close it when done. See WithCompileCache and NewCompileCache.
func NewCompileCache ¶
func NewCompileCache() *CompileCache
NewCompileCache returns an empty CompileCache ready to pass to WithCompileCache. Close it (CompileCache.Close) alongside the Runtime it is paired with.
type CopyResult ¶ added in v0.8.0
type CopyResult = instance.CopyResult
CopyResult is how a stream or future copy ended.
type EnumDesc ¶
EnumDesc is a set of named cases with no payloads. Its Value is the case index as a uint32.
type ErrorContext ¶ added in v0.8.0
type ErrorContext = instance.ErrorContext
ErrorContext is a WIT error-context, as the host gets one: an import's argument or an export's result. The host passes one, or a string to make one of, the other way.
func NewErrorContext ¶ added in v0.8.0
func NewErrorContext(msg string) *ErrorContext
NewErrorContext is an error context of the host's, with message msg.
type FixedListDesc ¶ added in v0.6.0
type FixedListDesc = binary.FixedListDesc
FixedListDesc is list<T, N>, a list of exactly Length elements (Length > 0). Its Value has ListDesc's shape -- the typed slice for a fixed-width primitive element, a []Value otherwise -- so ListOf reads it; lowering either shape with any other length is an error. On the wire it is a tuple of N T's: no pointer, no length, no allocation.
type FuncDesc ¶
FuncDesc, and its parts, describe a whole host func signature. Build one with TypeTable.Func rather than by hand.
type FuncParam ¶
FuncDesc, and its parts, describe a whole host func signature. Build one with TypeTable.Func rather than by hand.
type FuncResult ¶
type FuncResult = binary.FuncResult
FuncDesc, and its parts, describe a whole host func signature. Build one with TypeTable.Func rather than by hand.
type FuncResults ¶
type FuncResults = binary.FuncResults
FuncDesc, and its parts, describe a whole host func signature. Build one with TypeTable.Func rather than by hand.
type FutureReader ¶ added in v0.8.0
type FutureReader = instance.FutureReader
The host's ends of a stream<T> or future<T>. The host makes a stream with Instance.NewStream or NewStreamOf, keeping the writer and handing the guest the other value, as a call argument or an import's result. An import argument of a stream type arrives as a *StreamReader, and an export's stream result is a handle the host takes with Instance.TakeStream.
Every operation runs on the instance's scheduler: between calls, inside a host import, or in an AsyncCall's Defer. Completion is a callback, not an event; a Write or Read pending on the guest completes from inside the guest's own stream builtin.
type FutureWriter ¶ added in v0.8.0
type FutureWriter = instance.FutureWriter
The host's ends of a stream<T> or future<T>. The host makes a stream with Instance.NewStream or NewStreamOf, keeping the writer and handing the guest the other value, as a call argument or an import's result. An import argument of a stream type arrives as a *StreamReader, and an export's stream result is a handle the host takes with Instance.TakeStream.
Every operation runs on the instance's scheduler: between calls, inside a host import, or in an AsyncCall's Defer. Completion is a callback, not an event; a Write or Read pending on the guest completes from inside the guest's own stream builtin.
type HandleTable ¶
type HandleTable = instance.HandleTable
HandleTable is one instance's resource handle table. Obtain it with WithResourcesHook; use it to mint own<T>/borrow<T> handles that sit nested inside a composite result, which the engine's automatic top-level handle translation does not reach. A host driving an exported interface mints the handles it passes in with Instance.ResourcesFor, which names the table of the component that defines the interface -- a composition's inner one, when the instance only re-exposes it.
type HostFunc ¶
HostFunc implements a synchronous component import: it receives the lifted arguments and returns the lifted results (or an error, which traps the guest call). Register it with WithImport.
type Instance ¶
Instance is a live component instance. Call its exports with Call / CallExport, and release it with Close. A wasi:http/incoming-handler component also satisfies http.Handler via ServeHTTP.
func Instantiate ¶
func Instantiate(ctx context.Context, r wazy.Runtime, componentBytes []byte, opts ...Option) (*Instance, error)
Instantiate decodes componentBytes as a WebAssembly Component Model component and instantiates it on r, returning a live Instance. Pass WithWASI to give it the WASI 0.2 host surface, and WithCompileCache to reuse compilation work across repeated instantiations. Close the returned Instance when done.
type ListDesc ¶
ListDesc is an unbounded sequence. Its Value is the Go slice of the element type when that element is a fixed-width primitive -- []byte for list<u8>, []uint32 for list<u32>, []float64 for list<f64>, []bool, []rune for list<char>, and so on -- and a []Value otherwise, as for a list of strings or of records.
Both shapes are accepted when lowering a scalar list, so a host func may hand over either; lifting produces the typed one.
type MapDesc ¶ added in v0.4.0
MapDesc is map<K,V>, an unordered association of keys to values. It has no wire representation of its own -- the Canonical ABI treats it exactly as list<tuple<K,V>> -- so its Value is the same shape as a list of tuples: a []Value of two-element []Value{key, value} pairs, in whatever order the guest produced them. See component.MapOf for reading one as a Go map[K]V. K is restricted by the spec to bool, an integer, char, or string (see binary.IsValidMapKeyPrimitive) -- TypeTable.Map enforces this when building one by hand.
type Option ¶
Option configures Instantiate. WithWASI and WithCompileCache produce Options.
func WithAsyncImport ¶
func WithAsyncImport(iface, name string, fn AsyncHostFunc, params, results []TypeDesc) Option
WithAsyncImport registers fn as the component's async-lowered import iface/name. Pair it with Instance.CallAsync so fn may complete the call later, from another goroutine (real I/O), via AsyncCall.Resolve.
func WithAsyncImportCustom ¶ added in v0.8.0
func WithAsyncImportCustom(iface, name string, fn AsyncHostFunc, fd FuncDesc, resolve Resolver) Option
WithAsyncImportCustom is WithAsyncImport with a hand-built signature, as WithImportCustom is WithImport's: build fd and resolve from a TypeTable.
func WithCompileCache ¶
func WithCompileCache(cache *CompileCache) Option
WithCompileCache reuses cache across this and future Instantiate calls of the same component bytes, skipping the repeated decode + core-module compile.
func WithComponentImport ¶ added in v0.6.0
WithComponentImport supplies componentBytes, a component binary, for the component's component import name -- `(import "name" (component ...))`, which `wac compose --import-dependencies` emits for each dependency it does not embed. The importing component instantiates the supplied component itself, as many times and with whatever arguments its own instance section says; with WithCompileCache, the supplied component's decode and compilation are cached like the importer's.
The supplied component is checked against the type the import declares, by the Component Model's subtyping rules, before anything is instantiated: it may import less and export more, and what it imports and exports must match. Instantiate fails with the mismatch otherwise.
func WithHostResourceDtor ¶
WithHostResourceDtor registers the Go destructor run when the guest drops an owned handle of the host resource tagged `tag`.
func WithHostState ¶
WithHostState attaches an opaque value to every Instance built with this option, retrievable with Instance.HostState. It is how a host implementation of a stateful interface keeps state that lives exactly as long as one Instance -- the shape wazy's own wasi:http server side uses to find its request/response tables from ServeHTTP.
Use a package-private key type, not a bare string, so two independent host implementations cannot collide:
type myHostKey struct{}
component.WithHostState(myHostKey{}, newMyHost())
h := inst.HostState(myHostKey{}).(*myHost)
func WithImport ¶
WithImport registers fn as the component's synchronous import iface/name, with the given WIT param/result types. iface is the interface name (e.g. "wasi:cli/environment") or "" for a top-level import; name is the function (or "" for a bare top-level func import).
func WithImportCustom ¶
WithImportCustom registers fn as the host implementation of iface/name with a hand-built signature -- the general form of WithImport, and the only one that can express a nested composite. Build fd and resolve from a TypeTable:
tbl := component.NewTypeTable()
fd := tbl.Func([]component.TypeRef{component.Prim("string")},
tbl.Result(tbl.List(component.Prim("string")), component.Prim("u32")))
opt := component.WithImportCustom("acme:api/host@1.0.0", "lookup", fn, fd, tbl.Resolver())
iface is matched with its "@x.y.z" version suffix stripped, so one registration serves every patch version of an interface.
func WithResourceTag ¶
WithResourceTag declares that the resource `name`, exported by the imported interface `iface`, is the one this host tags as `tag` when minting handles.
Required for any resource-bearing interface: the guest drops handles through a canon carrying the component binary's own type index, while the host mints them under a tag of its choosing. Without this mapping the two numberings disagree and the first drop trips the handle table's cross-type check.
func WithResourcesHook ¶
func WithResourcesHook(hook func(*HandleTable)) Option
WithResourcesHook registers a callback run once per instantiation, with that instance's HandleTable, before any host func executes. This is how a host implementation gets the table it needs to mint nested handles.
type OptionDesc ¶
type OptionDesc = binary.OptionDesc
OptionDesc is option<T>. Its Value is nil for none, or the inner value.
type OwnDesc ¶
OwnDesc is own<R> -- an owned handle to a resource. Lifting one gives the host the rep it names and consumes the guest's handle.
type PendingCall ¶
type PendingCall = instance.PendingCall
PendingCall is a live CallAsync invocation, suspended awaiting external import completions. See Instance.CallAsync.
type PrimitiveDesc ¶
type PrimitiveDesc = binary.PrimitiveDesc
PrimitiveDesc is bool, s8-s64, u8-u64, f32, f64, char, or string. See Prim for the ergonomic spelling.
type RecordDesc ¶
type RecordDesc = binary.RecordDesc
RecordDesc is a struct with named fields. Its Value is a []Value in field order.
type RecordField ¶
type RecordField = binary.RecordField
RecordField is one named field of a RecordDesc.
type Resolver ¶
Resolver maps a TypeRef's index back to its descriptor. TypeTable.Resolver produces the one matching a table.
type ResultDesc ¶
type ResultDesc = binary.ResultDesc
ResultDesc is result<T, E>; either arm may be absent. Its Value is a ResultValue.
type ResultValue ¶
type ResultValue = abi.ResultValue
ResultValue is the Go shape of a result value. IsErr selects the arm; Payload is that arm's value, or nil for an arm declared without a type.
A result is NOT a Go error: returning a Go error from a HostFunc traps the guest, whereas a ResultValue with IsErr set is an ordinary value the guest receives and can handle. Use the error return only for "this call cannot proceed", and ResultValue for a WIT-declared failure.
type Some ¶ added in v0.8.0
Some is some(v) for an option whose payload is itself an option, where nil would be none at either level: Some{nil} is some(none). Such an option lifts with it; any option takes it, or a bare value, when lowered.
type StreamReader ¶ added in v0.8.0
type StreamReader = instance.StreamReader
The host's ends of a stream<T> or future<T>. The host makes a stream with Instance.NewStream or NewStreamOf, keeping the writer and handing the guest the other value, as a call argument or an import's result. An import argument of a stream type arrives as a *StreamReader, and an export's stream result is a handle the host takes with Instance.TakeStream.
Every operation runs on the instance's scheduler: between calls, inside a host import, or in an AsyncCall's Defer. Completion is a callback, not an event; a Write or Read pending on the guest completes from inside the guest's own stream builtin.
type StreamWriter ¶ added in v0.8.0
type StreamWriter = instance.StreamWriter
The host's ends of a stream<T> or future<T>. The host makes a stream with Instance.NewStream or NewStreamOf, keeping the writer and handing the guest the other value, as a call argument or an import's result. An import argument of a stream type arrives as a *StreamReader, and an export's stream result is a handle the host takes with Instance.TakeStream.
Every operation runs on the instance's scheduler: between calls, inside a host import, or in an AsyncCall's Defer. Completion is a callback, not an event; a Write or Read pending on the guest completes from inside the guest's own stream builtin.
type TypeDesc ¶
TypeDesc is one WIT type. The concrete descriptors below implement it. It is a sealed interface -- a type outside wazy cannot implement it, because the ABI dispatches on the concrete descriptors and an unknown one has no defined lowering.
type TypeRef ¶
TypeRef refers to a type from inside a composite: either a primitive (spelled inline) or an index into the TypeTable the enclosing FuncDesc was built with. Prefer the TypeTable sugar constructors over building these by hand.
type TypeTable ¶
type TypeTable struct {
// contains filtered or unexported fields
}
TypeTable interns the composite types one host func's signature refers to, handing back a TypeRef for each. It exists because a WIT type is a graph, not a tree: `list<list<u8>>` needs the inner `list<u8>` to be nameable from the outer one, and a TypeRef names it by index into exactly this table.
One table per func signature. Indices are local to it, and the Resolver it produces is what the engine uses to walk back from a TypeRef to a descriptor, so a FuncDesc and the table it was built from must be passed to WithImportCustom together.
The Add method is the primitive; the sugar methods below (List, FixedList, Map, Option, Result, Tuple, Record, Variant) cover the shapes that actually occur and keep TypeRef out of caller code:
tbl := component.NewTypeTable()
fd := tbl.Func(
[]component.TypeRef{tbl.Record("name", component.Prim("string"), "count", component.Prim("u32"))},
tbl.Result(tbl.List(component.Prim("string")), component.Prim("u32")),
)
opt := component.WithImportCustom("acme:api/host@1.0.0", "lookup", fn, fd, tbl.Resolver())
A TypeTable is not safe for concurrent use; build a signature on one goroutine, then it is read-only.
func (*TypeTable) Add ¶
Add interns td and returns the TypeRef naming it. A primitive is returned inline (it needs no table slot), so Add(PrimitiveDesc{...}) and Prim(...) are interchangeable.
func (*TypeTable) Enum ¶
Enum interns an enum of the named cases. A value of it is the case index as a uint32.
func (*TypeTable) FixedList ¶ added in v0.6.0
FixedList interns list<elem, n>, a list of exactly n elements.
The spec has no fixed-length list of none. Panics if n is 0.
func (*TypeTable) Flags ¶
Flags interns a flags bitset of the named flags. A value of it is a uint32 whose bits are set in declaration order.
func (*TypeTable) Func ¶
Func assembles a FuncDesc from params and a single unnamed result. Pass the zero TypeRef for a func that returns nothing.
func (*TypeTable) Future ¶ added in v0.8.0
Future interns future<elem>. Pass the zero TypeRef for a bare future.
func (*TypeTable) Map ¶ added in v0.4.0
Map interns map<key, value>.
A map's key is restricted to bool, an integer, char, or string (see binary.IsValidMapKeyPrimitive). Panics on any other key type.
func (*TypeTable) Own ¶
Own interns own<R> for the resource identified by tag -- the same tag passed to WithResourceTag and used when minting handles.
func (*TypeTable) Record ¶
Record interns a record from alternating name/type pairs: Record("port", Prim("u16"), "host", Prim("string")). Panics on an odd number of arguments or a non-string in a name position, since both are programmer errors in a signature that is built once at startup.
func (*TypeTable) Resolver ¶
Resolver returns the Resolver over the table's current entries. Call it after the signature is fully built.
func (*TypeTable) Result ¶
Result interns result<ok, err>. Pass the zero TypeRef for an arm the WIT declares without a type: Result(ok, TypeRef{}) is `result<ok>`, and Result(TypeRef{}, TypeRef{}) is a bare `result`.
func (*TypeTable) Stream ¶ added in v0.8.0
Stream interns stream<elem>. Pass the zero TypeRef for a bare stream.
func (*TypeTable) Variant ¶
func (t *TypeTable) Variant(cases ...VariantCaseSpec) TypeRef
Variant interns a variant. Each case is a name and an optional payload; pass the zero TypeRef for a case that carries none. Case order is the discriminant order a VariantValue's Disc indexes into.
type Value ¶
Value is a component-level call value: a Go value matching the Canonical ABI's lifting of a WIT type (uint32, int64, float64, string, []any for records/tuples and for lists of anything but a fixed-width primitive, uint32 for resource handles). It is the element type of Call/CallExport arguments and results and of host-import args/results.
A list of a fixed-width primitive is the Go slice of that primitive rather than a []Value -- see ListDesc in types.go -- and a fixed-length list<T, N> has the same shape, of N elements. A map<K,V> has no Canonical ABI representation of its own and lifts exactly as list<tuple<K,V>> would: a []Value of two-element []Value{key, value} pairs -- see MapDesc and MapOf.
type VariantCase ¶
type VariantCase = binary.VariantCase
VariantCase is one case of a VariantDesc; a nil Type means no payload.
type VariantCaseSpec ¶
VariantCaseSpec is one case for TypeTable.Variant: a name, and a payload type or the zero TypeRef for none.
type VariantDesc ¶
type VariantDesc = binary.VariantDesc
VariantDesc is a discriminated union. Its Value is a VariantValue.
type VariantValue ¶
type VariantValue = abi.VariantValue
VariantValue is the Go shape of a variant value: Disc is the case index in declaration order, Payload is that case's value (nil when the case carries none).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package binary decodes a WebAssembly component binary -- its imports, exports, types, embedded core modules and instantiation graph -- without a wazy.Runtime: decoding is pure and compiles nothing.
|
Package binary decodes a WebAssembly component binary -- its imports, exports, types, embedded core modules and instantiation graph -- without a wazy.Runtime: decoding is pure and compiles nothing. |
|
Package bindgen generates Go bindings for a WIT world, so a host calls and implements a component's interfaces in Go types rather than in component.Values:
|
Package bindgen generates Go bindings for a WIT world, so a host calls and implements a component's interfaces in Go types rather than in component.Values: |
|
internal/convtest
Package convtest binds the WIT world conv.
|
Package convtest binds the WIT world conv. |
|
internal/kitchen
Package kitchen binds the WIT world kitchen.
|
Package kitchen binds the WIT world kitchen. |
|
internal/storebind
Package storebind binds the WIT world app.
|
Package storebind binds the WIT world app. |
|
internal/storebind/tree/app
Package app binds the WIT world app.
|
Package app binds the WIT world app. |
|
internal/storebind/tree/example/store/v1.0.0/kv
Package kv binds the WIT interface example:store/kv@1.0.0, for a host implementing it.
|
Package kv binds the WIT interface example:store/kv@1.0.0, for a host implementing it. |
|
internal/storebind/with
Package with binds the WIT world app.
|
Package with binds the WIT world app. |
|
Package componenttest provides utilities for testing a host implementation of a component interface.
|
Package componenttest provides utilities for testing a host implementation of a component interface. |
|
Package wit reads WIT -- the WebAssembly Interface Type language -- into the descriptors component.WithImportCustom takes, so a host can register an interface from its .wit file instead of building each signature by hand.
|
Package wit reads WIT -- the WebAssembly Interface Type language -- into the descriptors component.WithImportCustom takes, so a host can register an interface from its .wit file instead of building each signature by hand. |
|
Package witgo holds the types and conversions that Go bindings generated by wazy-bindgen (see package bindgen) are written in terms of: WIT's result and tuple types, and the reading of a component.Value into the Go type a WIT primitive maps to.
|
Package witgo holds the types and conversions that Go bindings generated by wazy-bindgen (see package bindgen) are written in terms of: WIT's result and tuple types, and the reading of a component.Value into the Go type a WIT primitive maps to. |