Versions in this module Expand all Collapse all v0 v0.1.0 Nov 11, 2026 Changes in this version + const ConfigFileName + const ConfigTemplate + const DefaultCacheMaxBytes + const DefaultCompileTimeout + const DefaultEdition + const DefaultGracePeriod + const DefaultMaxOutput + const DefaultTimeout + const DefaultWASMMemoryLimit + var Backends = []Backend + var ErrABIMismatch = errdefs.ErrABIMismatch + var ErrClosed = errdefs.ErrClosed + var ErrCompilation = errdefs.ErrCompilation + var ErrDependencyPolicy = errdefs.ErrDependencyPolicy + var ErrFunctionNotFound = errdefs.ErrFunctionNotFound + var ErrMemoryLimit = errdefs.ErrMemoryLimit + var ErrOutputLimit = errdefs.ErrOutputLimit + var ErrTargetNotInstalled = errdefs.ErrTargetNotInstalled + var ErrTimeout = errdefs.ErrTimeout + var ErrToolchainNotFound = errdefs.ErrToolchainNotFound + var ErrUnsupported = errdefs.ErrUnsupported + var ErrUntrusted = errdefs.ErrUntrusted + func Version() string + type Artifact struct + Backend Backend + BuildDuration time.Duration + Cached bool + Key string + Kind ArtifactKind + Path string + Size int64 + Target string + Warnings []Diagnostic + type ArtifactKind string + const ArtifactLibrary + const ArtifactProgram + type Backend string + const BackendAuto + const BackendNativeLibrary + const BackendNativeProcess + const BackendWASM + func ParseBackend(s string) (Backend, error) + type BackendStatus struct + Backend Backend + Capabilities Capabilities + Problems []string + Target string + Usable bool + type CacheStats struct + Bytes int64 + Dir string + Enabled bool + Entries int + MaxBytes int64 + OtherBytes int64 + type CallError struct + Function string + Message string + func (e *CallError) Error() string + type Capabilities struct + Args bool + Backend Backend + Call bool + CaptureOutput bool + Env bool + FilesystemIsolation bool + Interruptible bool + MemoryLimit bool + NetworkIsolation bool + OSSandbox bool + ProcessIsolation bool + RequiresTrust bool + Run bool + Sandboxed bool + Stdin bool + Threads bool + WorkingDir bool + func CapabilitiesOf(b Backend) Capabilities + type Code string + type CompileError struct + Diagnostics []Diagnostic + Output string + Reason string + Target string + func (e *CompileError) Error() string + func (e *CompileError) Errors() []Diagnostic + func (e *CompileError) Rendered() string + func (e *CompileError) Unwrap() []error + type CompileOption interface + type Dependency struct + Branch string + Features []string + Git string + Name string + NoDefaultFeatures bool + Path string + Registry string + Rev string + Tag string + Version string + type DependencyPolicy struct + AllowGit bool + AllowPath bool + AllowRegistry bool + Crates []string + Network bool + type Diagnostic struct + Children []Diagnostic + Code string + Message string + Rendered string + Severity string + Spans []Span + func (d Diagnostic) Location() string + type ExitError struct + Code int + Panic *PanicError + Signal string + Trap string + func (e *ExitError) Error() string + func (e *ExitError) Unwrap() error + type File string + type Fragment struct + Column int + File string + Line int + Text string + type Fragments []Fragment + type Function struct + Name string + Signature string + type HostFunc func(ctx context.Context, args []Value) (Value, error) + type Kind uint8 + const KindBool + const KindBytes + const KindFloat32 + const KindFloat64 + const KindInt32 + const KindInt64 + const KindJSON + const KindString + const KindUint32 + const KindUint64 + const KindVoid + func (k Kind) String() string + type Module struct + func (m *Module) Call(ctx context.Context, name string, args ...Value) (Value, error) + func (m *Module) CallRaw(ctx context.Context, name string, sig Signature, args ...Value) (Value, error) + func (m *Module) Close() error + func (m *Module) Functions(ctx context.Context) ([]Function, error) + func (m *Module) Info() ModuleInfo + type ModuleInfo struct + Backend Backend + Key string + Path string + Target string + type Mount struct + GuestPath string + HostPath string + ReadOnly bool + type Option interface + func WithCache(enabled bool) Option + func WithCacheDir(dir string) Option + func WithCacheMaxBytes(n int64) Option + func WithCompilerSandbox(enabled bool) Option + func WithConfigFile(path string) Option + func WithDependencyPolicy(p DependencyPolicy) Option + func WithLogger(l *slog.Logger) Option + func WithMaxConcurrentBuilds(n int) Option + func WithToolchain(tc ToolchainConfig) Option + func WithTrust(level TrustLevel) Option + type PanicError struct + Column int + File string + Line int + Message string + Thread string + func (e *PanicError) Error() string + type Profile string + const ProfileDebug + const ProfileRelease + type Project string + type Report struct + Backends []BackendStatus + Cache CacheStats + DefaultBackend Backend + GoVersion string + Platform string + Toolchain *ToolchainInfo + ToolchainError string + Trust string + Version string + type ResourceUsage struct + PeakMemoryBytes uint64 + SystemCPU time.Duration + UserCPU time.Duration + type Result struct + Artifact *Artifact + Backend Backend + Duration time.Duration + ExitCode int + Stderr string + Stdout string + Usage ResourceUsage + type RunOption interface + func WithArgs(args ...string) RunOption + func WithStderr(w io.Writer) RunOption + func WithStdin(r io.Reader) RunOption + func WithStdout(w io.Writer) RunOption + type Runtime struct + func New(opts ...Option) (*Runtime, error) + func (r *Runtime) Build(ctx context.Context, src Source, kind ArtifactKind, opts ...CompileOption) (*Artifact, error) + func (r *Runtime) CacheStats() (CacheStats, error) + func (r *Runtime) ClearCache() error + func (r *Runtime) Close() error + func (r *Runtime) Compile(ctx context.Context, src Source, opts ...CompileOption) (*Module, error) + func (r *Runtime) Inspect(ctx context.Context) (*Report, error) + func (r *Runtime) LoadModule(ctx context.Context, path string, opts ...CompileOption) (*Module, error) + func (r *Runtime) LoadWASM(ctx context.Context, code []byte, opts ...CompileOption) (*Module, error) + func (r *Runtime) Run(ctx context.Context, src Source, opts ...RunOption) (*Result, error) + func (r *Runtime) Toolchain(ctx context.Context) (*ToolchainInfo, error) + type Sandbox struct + AllowNetwork bool + Readable []string + Writable []string + type SharedOption interface + func WithBackend(b Backend) SharedOption + func WithBuildEnv(env map[string]string) SharedOption + func WithBuildOutput(w io.Writer) SharedOption + func WithCompileTimeout(d time.Duration) SharedOption + func WithDependencies(deps ...Dependency) SharedOption + func WithDir(dir string) SharedOption + func WithEdition(edition string) SharedOption + func WithEnv(env map[string]string) SharedOption + func WithGracePeriod(d time.Duration) SharedOption + func WithHostFunction(name string, fn HostFunc) SharedOption + func WithInheritEnv(names ...string) SharedOption + func WithMaxOutput(n int64) SharedOption + func WithMemoryLimit(n int64) SharedOption + func WithMount(m Mount) SharedOption + func WithOptLevel(level string) SharedOption + func WithProfile(p Profile) SharedOption + func WithRustFlags(flags ...string) SharedOption + func WithSandbox(s Sandbox) SharedOption + func WithTimeout(d time.Duration) SharedOption + func WithWASMDeterminism(seed uint64) SharedOption + func WithWASMInterruption(enabled bool) SharedOption + func WithWASMMemoryLimit(n int64) SharedOption + type Signature struct + Params []Kind + Result Kind + func (s Signature) String() string + type Source interface + type Span struct + Column int + EndColumn int + EndLine int + File string + Label string + Line int + Primary bool + type TargetError struct + Backend Backend + Fix string + Target string + func (e *TargetError) Error() string + func (e *TargetError) Unwrap() error + type ToolchainConfig struct + Cargo string + CargoHome string + Rustc string + RustupHome string + Toolchain string + type ToolchainInfo struct + Cargo string + CargoVersion string + CommitDate string + CommitHash string + Host string + LLVMVersion string + Rustc string + Rustup string + Sysroot string + Targets []string + Version string + func (t *ToolchainInfo) HasTarget(triple string) bool + type TrustLevel int + const Trusted + const Untrusted + func ParseTrustLevel(s string) (TrustLevel, error) + func (t TrustLevel) String() string + type UnsupportedError struct + Backend Backend + Feature string + Hint string + func (e *UnsupportedError) Error() string + func (e *UnsupportedError) Unwrap() error + type Value struct + func Bool(b bool) Value + func Bytes(b []byte) Value + func Float32(f float32) Value + func Float64(f float64) Value + func Int32(n int32) Value + func Int64(n int64) Value + func JSON(v any) (Value, error) + func RawJSON(data []byte) (Value, error) + func String(s string) Value + func Uint32(n uint32) Value + func Uint64(n uint64) Value + func Void() Value + func (v Value) AsBool() (bool, error) + func (v Value) AsBytes() ([]byte, error) + func (v Value) AsFloat32() (float32, error) + func (v Value) AsFloat64() (float64, error) + func (v Value) AsInt32() (int32, error) + func (v Value) AsInt64() (int64, error) + func (v Value) AsJSON() ([]byte, error) + func (v Value) AsString() (string, error) + func (v Value) AsUint32() (uint32, error) + func (v Value) AsUint64() (uint64, error) + func (v Value) Decode(dst any) error + func (v Value) Kind() Kind + func (v Value) String() string