kitchen

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kitchen binds the WIT world kitchen.

Index

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) Area

func (x API) Area(ctx context.Context, s Shape) (float64, error)

Area calls the export area.

func (API) BlobJoin

func (x API) BlobJoin(ctx context.Context, a Blob, b Blob) (Blob, error)

BlobJoin calls the export [static]blob.join.

func (API) BlobSize

func (x API) BlobSize(ctx context.Context, b Blob) (uint32, error)

BlobSize calls the export blob-size.

func (API) Check

func (x API) Check(ctx context.Context, n uint32) (witgo.Result[uint32, string], error)

Check calls the export check.

func (API) ClassifyAll

func (x API) ClassifyAll(ctx context.Context, xs []Shape) ([]witgo.Result[Color, string], error)

ClassifyAll calls the export classify-all.

func (API) ColorOf

func (x API) ColorOf(ctx context.Context, s Shape) (witgo.Result[Color, string], error)

ColorOf calls the export color-of.

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

func (x API) CountTicks(ctx context.Context, s *witgo.StreamReader[struct{}]) (uint32, error)

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) Double

func (x API) Double(ctx context.Context, f *witgo.FutureReader[uint32]) (uint32, error)

Double calls the export double.

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) Fail

func (x API) Fail(ctx context.Context, msg string) (*component.ErrorContext, error)

Fail calls the export fail.

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) Fetch

func (x API) Fetch(ctx context.Context, a uint32, b uint32) (uint32, error)

Fetch calls the export fetch.

func (API) FetchAsync

func (x API) FetchAsync(ctx context.Context, a uint32, b uint32) (*witgo.Pending[uint32], error)

FetchAsync starts the export fetch and returns once it first waits; Await the result.

func (API) FetchShape

func (x API) FetchShape(ctx context.Context, s Shape) (witgo.Result[Color, string], error)

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

func (x API) FetchTokens(ctx context.Context, a uint32, b uint32) (uint32, error)

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) Fire

func (x API) Fire(ctx context.Context) (uint32, error)

Fire calls the export fire.

func (API) FireAsync

func (x API) FireAsync(ctx context.Context) (*witgo.Pending[uint32], error)

FireAsync starts the export fire and returns once it first waits; Await the result.

func (API) First

func (x API) First(ctx context.Context, xs []Point) (*Point, error)

First calls the export first.

func (API) GiveToken

func (x API) GiveToken(ctx context.Context, v uint32) (Token, error)

GiveToken calls the export give-token.

func (API) HandOff

func (x API) HandOff(ctx context.Context, v uint32) (uint32, error)

HandOff calls the export hand-off.

func (API) HandOffAsync

func (x API) HandOffAsync(ctx context.Context, v uint32) (*witgo.Pending[uint32], error)

HandOffAsync starts the export hand-off and returns once it first waits; Await the result.

func (API) JoinErrors

func (x API) JoinErrors(ctx context.Context, es []*component.ErrorContext) (string, error)

JoinErrors calls the export join-errors.

func (API) MakeBlobs

func (x API) MakeBlobs(ctx context.Context, n uint32) ([]Blob, error)

MakeBlobs calls the export make-blobs.

func (API) MakeBody

func (x API) MakeBody(ctx context.Context, n uint32) (Body, error)

MakeBody calls the export make-body.

func (API) MakeBodyAsync

func (x API) MakeBodyAsync(ctx context.Context, n uint32) (*witgo.Pending[Body], error)

MakeBodyAsync starts the export make-body and returns once it first waits; Await the result.

func (API) Nest

func (x API) Nest(ctx context.Context, x_ **uint32) (**uint32, error)

Nest calls the export nest.

func (API) NewBlob

func (x API) NewBlob(ctx context.Context, init string) (Blob, error)

NewBlob calls the export [constructor]blob.

func (API) Nothing

func (x API) Nothing(ctx context.Context) error

Nothing calls the export nothing.

func (API) PairTokens

func (x API) PairTokens(ctx context.Context, a uint32, b uint32) (uint32, error)

PairTokens calls the export pair-tokens.

func (API) PeekToken

func (x API) PeekToken(ctx context.Context, t Token) (uint32, error)

PeekToken calls the export peek-token.

func (API) PickName

func (x API) PickName(ctx context.Context, c Color, p Perms) (*string, error)

PickName calls the export pick-name.

func (API) PipeBody

func (x API) PipeBody(ctx context.Context, n uint32) (uint32, error)

PipeBody calls the export pipe-body.

func (API) PipeBodyAsync

func (x API) PipeBodyAsync(ctx context.Context, n uint32) (*witgo.Pending[uint32], error)

PipeBodyAsync starts the export pipe-body and returns once it first waits; Await the result.

func (API) PipeSpilled

func (x API) PipeSpilled(ctx context.Context, n uint32) (uint32, error)

PipeSpilled calls the export pipe-spilled.

func (API) PipeSpilledAsync

func (x API) PipeSpilledAsync(ctx context.Context, n uint32) (*witgo.Pending[uint32], error)

PipeSpilledAsync starts the export pipe-spilled and returns once it first waits; Await the result.

func (API) Points

func (x API) Points(ctx context.Context, n uint32) (*witgo.StreamReader[Point], error)

Points calls the export points.

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) ReadBody

func (x API) ReadBody(ctx context.Context, b Body) (uint32, error)

ReadBody calls the export read-body.

func (API) ReadBodyAsync

func (x API) ReadBodyAsync(ctx context.Context, b Body) (*witgo.Pending[uint32], error)

ReadBodyAsync starts the export read-body and returns once it first waits; Await the result.

func (API) Ready

func (x API) Ready(ctx context.Context, v uint32) (*witgo.FutureReader[uint32], error)

Ready calls the export ready.

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) Reason

func (x API) Reason(ctx context.Context, e *component.ErrorContext) (string, error)

Reason calls the export reason.

func (API) Relay

func (x API) Relay(ctx context.Context, n uint32) (int32, error)

Relay calls the export relay.

func (API) RelayAsync

func (x API) RelayAsync(ctx context.Context, n uint32) (*witgo.Pending[int32], error)

RelayAsync starts the export relay and returns once it first waits; Await the result.

func (API) RelayError

func (x API) RelayError(ctx context.Context, code uint32) (string, error)

RelayError calls the export relay-error.

func (API) RelayErrors

func (x API) RelayErrors(ctx context.Context, n uint32) (string, error)

RelayErrors calls the export relay-errors.

func (API) RelaySpilled

func (x API) RelaySpilled(ctx context.Context, n uint32) (string, error)

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) SomeError

func (x API) SomeError(ctx context.Context, fail bool) (**component.ErrorContext, error)

SomeError calls the export some-error.

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) SumBytes

func (x API) SumBytes(ctx context.Context, s *witgo.StreamReader[uint8]) (uint32, error)

SumBytes calls the export sum-bytes.

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

Swap calls the export swap.

func (API) TakeToken

func (x API) TakeToken(ctx context.Context, t Token) (uint32, error)

TakeToken calls the export take-token.

func (API) Tally

func (x API) Tally(ctx context.Context, ts []Token) (uint32, error)

Tally calls the export tally.

func (API) UseCounter

func (x API) UseCounter(ctx context.Context, start uint32, by uint32) (uint32, error)

UseCounter calls the export use-counter.

func (API) UseTokens

func (x API) UseTokens(ctx context.Context, a uint32, b uint32) (uint32, error)

UseTokens calls the export use-tokens.

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) Append

func (x Blob) Append(ctx context.Context, s string) error

Append calls the export [method]blob.append.

func (Blob) Drop

func (x Blob) Drop(ctx context.Context) error

Drop drops the handle, running the component's destructor for it.

func (Blob) Handle

func (x Blob) Handle() uint32

Handle is the handle's index in the instance's table.

func (Blob) Measure

func (x Blob) Measure(ctx context.Context) (uint32, error)

Measure calls the export [method]blob.measure.

func (Blob) MeasureAsync

func (x Blob) MeasureAsync(ctx context.Context) (*witgo.Pending[uint32], error)

MeasureAsync starts the export [method]blob.measure and returns once it first waits; Await the result.

func (Blob) Read

func (x Blob) Read(ctx context.Context) (string, error)

Read calls the export [method]blob.read.

type Body

type Body struct {
	Data    *witgo.StreamReader[uint8]
	Trailer *witgo.FutureReader[uint32]
}

Body is the WIT record body.

type Color

type Color uint32

Color is the WIT enum color.

const (
	ColorRed   Color = 0
	ColorGreen Color = 1
	ColorBlue  Color = 2
)

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 Imports

type Imports struct {
	Types Types
	Host  Host
}

Imports are the host's implementations of the world's imports.

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) API

func (x *Kitchen) API() API

API is the instance's export wazy:bindgen-test/api@0.1.0.

func (*Kitchen) Close

func (x *Kitchen) Close(ctx context.Context) error

Close closes the instance.

func (*Kitchen) Instance

func (x *Kitchen) Instance() *component.Instance

Instance is the underlying component instance.

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.

func (*Kitchen) Ping

func (x *Kitchen) Ping(ctx context.Context, s string) (string, error)

Ping calls the export ping.

func (*Kitchen) Top

func (x *Kitchen) Top(ctx context.Context, s string) (string, error)

Top calls the export top.

func (*Kitchen) TopAsync

func (x *Kitchen) TopAsync(ctx context.Context, s string) (*witgo.Pending[string], error)

TopAsync starts the export top and returns once it first waits; Await the result.

type Perms

type Perms uint32

Perms is the WIT flags perms.

const (
	PermsRead  Perms = 1 << 0
	PermsWrite Perms = 1 << 1
	PermsExec  Perms = 1 << 2
)

type Point

type Point struct {
	X     int32
	Y     int32
	Label string
}

Point is the WIT record point.

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

func ShapeCircle(v float64) Shape

ShapeCircle is the circle case of Shape, holding v.

func ShapeEmpty

func ShapeEmpty() Shape

ShapeEmpty is the empty case of Shape.

func ShapeRect

func ShapeRect(v Point) Shape

ShapeRect is the rect case of Shape, holding v.

func (Shape) Circle

func (x Shape) Circle() (float64, bool)

Circle is the circle case's payload, and whether x holds that case.

func (Shape) Rect

func (x Shape) Rect() (Point, bool)

Rect is the rect case's payload, and whether x holds that case.

type ShapeCase

type ShapeCase uint32

ShapeCase is a case of Shape.

const (
	ShapeCaseCircle ShapeCase = 0
	ShapeCaseRect   ShapeCase = 1
	ShapeCaseEmpty  ShapeCase = 2
)

type Token

type Token uint32

Token is the host's representation of the WIT resource wazy:bindgen-test/types@0.1.0.token: the value the host returns from its constructor, and receives back as self.

type Types

type Types interface {
	// DropToken releases a Token the guest dropped.
	DropToken(ctx context.Context, self Token) error
}

Types is the host's implementation of wazy:bindgen-test/types@0.1.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL