Documentation
¶
Overview ¶
Package kitchen binds the WIT world kitchen.
Index ¶
- type API
- func (x API) Area(ctx context.Context, s Shape) (float64, error)
- func (x API) BlobJoin(ctx context.Context, a Blob, b Blob) (Blob, error)
- func (x API) BlobSize(ctx context.Context, b Blob) (uint32, error)
- func (x API) Check(ctx context.Context, n uint32) (witgo.Result[uint32, string], error)
- func (x API) ClassifyAll(ctx context.Context, xs []Shape) ([]witgo.Result[Color, string], error)
- func (x API) ColorOf(ctx context.Context, s Shape) (witgo.Result[Color, string], error)
- func (x API) ColorOfAsync(ctx context.Context, s Shape) (*witgo.Pending[witgo.Result[Color, string]], error)
- func (x API) CountTicks(ctx context.Context, s *witgo.StreamReader[struct{}]) (uint32, error)
- func (x API) CountTicksAsync(ctx context.Context, s *witgo.StreamReader[struct{}]) (*witgo.Pending[uint32], error)
- func (x API) Double(ctx context.Context, f *witgo.FutureReader[uint32]) (uint32, error)
- func (x API) DoubleAsync(ctx context.Context, f *witgo.FutureReader[uint32]) (*witgo.Pending[uint32], error)
- func (x API) Fail(ctx context.Context, msg string) (*component.ErrorContext, error)
- func (x API) FailAsync(ctx context.Context, msg string) (*witgo.Pending[*component.ErrorContext], error)
- func (x API) Fetch(ctx context.Context, a uint32, b uint32) (uint32, error)
- func (x API) FetchAsync(ctx context.Context, a uint32, b uint32) (*witgo.Pending[uint32], error)
- func (x API) FetchShape(ctx context.Context, s Shape) (witgo.Result[Color, string], error)
- func (x API) FetchShapeAsync(ctx context.Context, s Shape) (*witgo.Pending[witgo.Result[Color, string]], error)
- func (x API) FetchTokens(ctx context.Context, a uint32, b uint32) (uint32, error)
- func (x API) FetchTokensAsync(ctx context.Context, a uint32, b uint32) (*witgo.Pending[uint32], error)
- func (x API) Fire(ctx context.Context) (uint32, error)
- func (x API) FireAsync(ctx context.Context) (*witgo.Pending[uint32], error)
- func (x API) First(ctx context.Context, xs []Point) (*Point, error)
- func (x API) GiveToken(ctx context.Context, v uint32) (Token, error)
- func (x API) HandOff(ctx context.Context, v uint32) (uint32, error)
- func (x API) HandOffAsync(ctx context.Context, v uint32) (*witgo.Pending[uint32], error)
- func (x API) JoinErrors(ctx context.Context, es []*component.ErrorContext) (string, error)
- func (x API) MakeBlobs(ctx context.Context, n uint32) ([]Blob, error)
- func (x API) MakeBody(ctx context.Context, n uint32) (Body, error)
- func (x API) MakeBodyAsync(ctx context.Context, n uint32) (*witgo.Pending[Body], error)
- func (x API) Nest(ctx context.Context, x_ **uint32) (**uint32, error)
- func (x API) NewBlob(ctx context.Context, init string) (Blob, error)
- func (x API) Nothing(ctx context.Context) error
- func (x API) PairTokens(ctx context.Context, a uint32, b uint32) (uint32, error)
- func (x API) PeekToken(ctx context.Context, t Token) (uint32, error)
- func (x API) PickName(ctx context.Context, c Color, p Perms) (*string, error)
- func (x API) PipeBody(ctx context.Context, n uint32) (uint32, error)
- func (x API) PipeBodyAsync(ctx context.Context, n uint32) (*witgo.Pending[uint32], error)
- func (x API) PipeSpilled(ctx context.Context, n uint32) (uint32, error)
- func (x API) PipeSpilledAsync(ctx context.Context, n uint32) (*witgo.Pending[uint32], error)
- func (x API) Points(ctx context.Context, n uint32) (*witgo.StreamReader[Point], error)
- func (x API) PointsAsync(ctx context.Context, n uint32) (*witgo.Pending[*witgo.StreamReader[Point]], error)
- func (x API) ReadBody(ctx context.Context, b Body) (uint32, error)
- func (x API) ReadBodyAsync(ctx context.Context, b Body) (*witgo.Pending[uint32], error)
- func (x API) Ready(ctx context.Context, v uint32) (*witgo.FutureReader[uint32], error)
- func (x API) ReadyAsync(ctx context.Context, v uint32) (*witgo.Pending[*witgo.FutureReader[uint32]], error)
- func (x API) Reason(ctx context.Context, e *component.ErrorContext) (string, error)
- func (x API) Relay(ctx context.Context, n uint32) (int32, error)
- func (x API) RelayAsync(ctx context.Context, n uint32) (*witgo.Pending[int32], error)
- func (x API) RelayError(ctx context.Context, code uint32) (string, error)
- func (x API) RelayErrors(ctx context.Context, n uint32) (string, error)
- func (x API) RelaySpilled(ctx context.Context, n uint32) (string, error)
- func (x API) Roundtrip(ctx context.Context, e Everything) (Everything, error)
- func (x API) SomeError(ctx context.Context, fail bool) (**component.ErrorContext, error)
- func (x API) SomeErrorAsync(ctx context.Context, fail bool) (*witgo.Pending[**component.ErrorContext], error)
- func (x API) SumBytes(ctx context.Context, s *witgo.StreamReader[uint8]) (uint32, error)
- func (x API) SumBytesAsync(ctx context.Context, s *witgo.StreamReader[uint8]) (*witgo.Pending[uint32], error)
- func (x API) Swap(ctx context.Context, t witgo.Tuple2[string, uint32]) (witgo.Tuple2[uint32, string], error)
- func (x API) TakeToken(ctx context.Context, t Token) (uint32, error)
- func (x API) Tally(ctx context.Context, ts []Token) (uint32, error)
- func (x API) UseCounter(ctx context.Context, start uint32, by uint32) (uint32, error)
- func (x API) UseTokens(ctx context.Context, a uint32, b uint32) (uint32, error)
- type Blob
- func (x Blob) Append(ctx context.Context, s string) error
- func (x Blob) Drop(ctx context.Context) error
- func (x Blob) Handle() uint32
- func (x Blob) Measure(ctx context.Context) (uint32, error)
- func (x Blob) MeasureAsync(ctx context.Context) (*witgo.Pending[uint32], error)
- func (x Blob) Read(ctx context.Context) (string, error)
- type Body
- type Color
- type Counter
- type Everything
- type Host
- type Imports
- type Kitchen
- func (x *Kitchen) API() API
- func (x *Kitchen) Close(ctx context.Context) error
- func (x *Kitchen) Instance() *component.Instance
- func (x *Kitchen) NewFutureResultColorString() (*witgo.FutureWriter[witgo.Result[Color, string]], ...)
- func (x *Kitchen) NewFutureU32() (*witgo.FutureWriter[uint32], *witgo.FutureReader[uint32], error)
- func (x *Kitchen) NewStream() (*witgo.StreamWriter[struct{}], *witgo.StreamReader[struct{}], error)
- func (x *Kitchen) NewStreamPoint() (*witgo.StreamWriter[Point], *witgo.StreamReader[Point], error)
- func (x *Kitchen) NewStreamU8() (*witgo.StreamWriter[uint8], *witgo.StreamReader[uint8], error)
- func (x *Kitchen) Ping(ctx context.Context, s string) (string, error)
- func (x *Kitchen) Top(ctx context.Context, s string) (string, error)
- func (x *Kitchen) TopAsync(ctx context.Context, s string) (*witgo.Pending[string], error)
- type Perms
- type Point
- type Shape
- type ShapeCase
- type Token
- type Types
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the export wazy:bindgen-test/api@0.1.0.
func (API) ClassifyAll ¶
ClassifyAll calls the export classify-all.
func (API) ColorOfAsync ¶
func (x API) ColorOfAsync(ctx context.Context, s Shape) (*witgo.Pending[witgo.Result[Color, string]], error)
ColorOfAsync starts the export color-of and returns once it first waits; Await the result.
func (API) CountTicks ¶
CountTicks calls the export count-ticks.
func (API) CountTicksAsync ¶
func (x API) CountTicksAsync(ctx context.Context, s *witgo.StreamReader[struct{}]) (*witgo.Pending[uint32], error)
CountTicksAsync starts the export count-ticks and returns once it first waits; Await the result.
func (API) DoubleAsync ¶
func (x API) DoubleAsync(ctx context.Context, f *witgo.FutureReader[uint32]) (*witgo.Pending[uint32], error)
DoubleAsync starts the export double and returns once it first waits; Await the result.
func (API) FailAsync ¶
func (x API) FailAsync(ctx context.Context, msg string) (*witgo.Pending[*component.ErrorContext], error)
FailAsync starts the export fail and returns once it first waits; Await the result.
func (API) FetchAsync ¶
FetchAsync starts the export fetch and returns once it first waits; Await the result.
func (API) FetchShape ¶
FetchShape calls the export fetch-shape.
func (API) FetchShapeAsync ¶
func (x API) FetchShapeAsync(ctx context.Context, s Shape) (*witgo.Pending[witgo.Result[Color, string]], error)
FetchShapeAsync starts the export fetch-shape and returns once it first waits; Await the result.
func (API) FetchTokens ¶
FetchTokens calls the export fetch-tokens.
func (API) FetchTokensAsync ¶
func (x API) FetchTokensAsync(ctx context.Context, a uint32, b uint32) (*witgo.Pending[uint32], error)
FetchTokensAsync starts the export fetch-tokens and returns once it first waits; Await the result.
func (API) FireAsync ¶
FireAsync starts the export fire and returns once it first waits; Await the result.
func (API) HandOffAsync ¶
HandOffAsync starts the export hand-off and returns once it first waits; Await the result.
func (API) JoinErrors ¶
JoinErrors calls the export join-errors.
func (API) MakeBodyAsync ¶
MakeBodyAsync starts the export make-body and returns once it first waits; Await the result.
func (API) PairTokens ¶
PairTokens calls the export pair-tokens.
func (API) PipeBodyAsync ¶
PipeBodyAsync starts the export pipe-body and returns once it first waits; Await the result.
func (API) PipeSpilled ¶
PipeSpilled calls the export pipe-spilled.
func (API) PipeSpilledAsync ¶
PipeSpilledAsync starts the export pipe-spilled and returns once it first waits; Await the result.
func (API) PointsAsync ¶
func (x API) PointsAsync(ctx context.Context, n uint32) (*witgo.Pending[*witgo.StreamReader[Point]], error)
PointsAsync starts the export points and returns once it first waits; Await the result.
func (API) ReadBodyAsync ¶
ReadBodyAsync starts the export read-body and returns once it first waits; Await the result.
func (API) ReadyAsync ¶
func (x API) ReadyAsync(ctx context.Context, v uint32) (*witgo.Pending[*witgo.FutureReader[uint32]], error)
ReadyAsync starts the export ready and returns once it first waits; Await the result.
func (API) RelayAsync ¶
RelayAsync starts the export relay and returns once it first waits; Await the result.
func (API) RelayError ¶
RelayError calls the export relay-error.
func (API) RelayErrors ¶
RelayErrors calls the export relay-errors.
func (API) RelaySpilled ¶
RelaySpilled calls the export relay-spilled.
func (API) Roundtrip ¶
func (x API) Roundtrip(ctx context.Context, e Everything) (Everything, error)
Roundtrip calls the export roundtrip.
func (API) SomeErrorAsync ¶
func (x API) SomeErrorAsync(ctx context.Context, fail bool) (*witgo.Pending[**component.ErrorContext], error)
SomeErrorAsync starts the export some-error and returns once it first waits; Await the result.
func (API) SumBytesAsync ¶
func (x API) SumBytesAsync(ctx context.Context, s *witgo.StreamReader[uint8]) (*witgo.Pending[uint32], error)
SumBytesAsync starts the export sum-bytes and returns once it first waits; Await the result.
func (API) Swap ¶
func (x API) Swap(ctx context.Context, t witgo.Tuple2[string, uint32]) (witgo.Tuple2[uint32, string], error)
Swap calls the export swap.
func (API) UseCounter ¶
UseCounter calls the export use-counter.
type Blob ¶
type Blob struct {
// contains filtered or unexported fields
}
Blob is a handle to the WIT resource wazy:bindgen-test/api@0.1.0.blob, which the component implements. Drop it when done with it.
func (Blob) MeasureAsync ¶
MeasureAsync starts the export [method]blob.measure and returns once it first waits; Await the result.
type Body ¶
type Body struct {
Data *witgo.StreamReader[uint8]
Trailer *witgo.FutureReader[uint32]
}
Body is the WIT record body.
type Counter ¶
type Counter uint32
Counter is the host's representation of the WIT resource wazy:bindgen-test/host@0.1.0.counter: the value the host returns from its constructor, and receives back as self.
type Everything ¶
type Everything struct {
B bool
Tiny int8
Utiny uint8
Short int16
Ushort uint16
Int int32
Uint uint32
Long int64
Ulong uint64
Single float32
Double float64
C rune
S string
Bytes []byte
Words []string
Points []Point
Maybe *Point
Nothing *uint32
Pair witgo.Tuple2[uint32, string]
Fixed [3]uint16
Col Color
Per Perms
Shapes []Shape
}
Everything is the WIT record everything.
type Host ¶
type Host interface {
NewCounter(ctx context.Context, start uint32) (Counter, error)
CounterBump(ctx context.Context, self Counter, by uint32) (uint32, error)
CounterZero(ctx context.Context) (Counter, error)
Echo(ctx context.Context, e Everything) (Everything, error)
Classify(ctx context.Context, s Shape) (witgo.Result[Color, string], error)
Checked(ctx context.Context, n uint32) (witgo.Result[struct{}, string], error)
Pick(ctx context.Context, c Color, p Perms) (*string, error)
Mint(ctx context.Context, v uint32) (Token, error)
Peek(ctx context.Context, t Token) (uint32, error)
MintPair(ctx context.Context, a uint32, b uint32) (witgo.Tuple2[Token, Token], error)
PeekAll(ctx context.Context, ts []Token) (uint32, error)
TryMint(ctx context.Context, v uint32) (witgo.Result[Token, string], error)
Deepen(ctx context.Context, x_ **uint32) (**uint32, error)
// SlowAdd is async: it may return its result through ret after it returns.
SlowAdd(ctx context.Context, a uint32, b uint32, ret witgo.Async[uint32]) error
// SlowShape is async: it may return its result through ret after it returns.
SlowShape(ctx context.Context, s Shape, ret witgo.Async[witgo.Result[Color, string]]) error
// SlowPing is async: it may return its result through ret after it returns.
SlowPing(ctx context.Context, ret witgo.Async[struct{}]) error
// SlowMint is async: it may return its result through ret after it returns.
SlowMint(ctx context.Context, a uint32, b uint32, ret witgo.Async[witgo.Tuple2[Token, Token]]) error
// CountUp is async: it may return its result through ret after it returns.
CountUp(ctx context.Context, n uint32, ret witgo.Async[*witgo.StreamReader[uint8]]) error
// SumPoints is async: it may return its result through ret after it returns.
SumPoints(ctx context.Context, s *witgo.StreamReader[Point], ret witgo.Async[int32]) error
ColorLater(ctx context.Context, s Shape) (*witgo.FutureReader[witgo.Result[Color, string]], error)
// WaitFor is async: it may return its result through ret after it returns.
WaitFor(ctx context.Context, f *witgo.FutureReader[uint32], ret witgo.Async[uint32]) error
Explain(ctx context.Context, code uint32) (*component.ErrorContext, error)
Describe(ctx context.Context, e *component.ErrorContext) (string, error)
// OpenBody is async: it may return its result through ret after it returns.
OpenBody(ctx context.Context, n uint32, ret witgo.Async[witgo.Result[Body, string]]) error
// SumBody is async: it may return its result through ret after it returns.
SumBody(ctx context.Context, b Body, ret witgo.Async[uint32]) error
Errors(ctx context.Context, n uint32) ([]*component.ErrorContext, error)
Messages(ctx context.Context, es []*component.ErrorContext) (string, error)
// SpillBody is async: it may return its result through ret after it returns.
SpillBody(ctx context.Context, a uint32, b uint32, c uint32, d uint32, x_ Body, ret witgo.Async[uint32]) error
SpillErrors(ctx context.Context, a uint32, b uint32, c uint32, d uint32, e uint32, f uint32, g uint32, h uint32, i uint32, j uint32, k uint32, l uint32, m uint32, n uint32, o uint32, p uint32, es []*component.ErrorContext) (string, error)
// DropCounter releases a Counter the guest dropped.
DropCounter(ctx context.Context, self Counter) error
}
Host is the host's implementation of wazy:bindgen-test/host@0.1.0.
type Kitchen ¶
type Kitchen struct {
// contains filtered or unexported fields
}
Kitchen is an instance of a component of the WIT world kitchen.
func Instantiate ¶
func Instantiate(ctx context.Context, r wazy.Runtime, wasm []byte, imports Imports, opts ...component.Option) (*Kitchen, error)
Instantiate instantiates a component of the world kitchen, with imports implementing its imports. opts are passed on to component.Instantiate, for what the bindings leave to the host, such as WASI.
func (*Kitchen) NewFutureResultColorString ¶
func (x *Kitchen) NewFutureResultColorString() (*witgo.FutureWriter[witgo.Result[Color, string]], *witgo.FutureReader[witgo.Result[Color, string]], error)
NewFutureResultColorString makes a future<result<color, string>>: write to the writer, and pass the reader to the component or read it.
func (*Kitchen) NewFutureU32 ¶
func (x *Kitchen) NewFutureU32() (*witgo.FutureWriter[uint32], *witgo.FutureReader[uint32], error)
NewFutureU32 makes a future<u32>: write to the writer, and pass the reader to the component or read it.
func (*Kitchen) NewStream ¶
func (x *Kitchen) NewStream() (*witgo.StreamWriter[struct{}], *witgo.StreamReader[struct{}], error)
NewStream makes a stream: write to the writer, and pass the reader to the component or read it.
func (*Kitchen) NewStreamPoint ¶
func (x *Kitchen) NewStreamPoint() (*witgo.StreamWriter[Point], *witgo.StreamReader[Point], error)
NewStreamPoint makes a stream<point>: write to the writer, and pass the reader to the component or read it.
func (*Kitchen) NewStreamU8 ¶
func (x *Kitchen) NewStreamU8() (*witgo.StreamWriter[uint8], *witgo.StreamReader[uint8], error)
NewStreamU8 makes a stream<u8>: write to the writer, and pass the reader to the component or read it.
type Shape ¶
type Shape struct {
Case ShapeCase
// contains filtered or unexported fields
}
Shape is the WIT variant shape: Case says which case it holds.
func ShapeCircle ¶
ShapeCircle is the circle case of Shape, holding v.