package runtime
import "cuelang.org/go/internal/core/runtime"
Index ¶
- Variables
- func RegisterBuiltin(importPath string, f PackageFunc)
- type Compiler
- type Config
- type Interpreter
- type PackageFunc
- type Runtime
- func New() *Runtime
- func NewWithSettings(v internal.EvaluatorVersion, flags cuedebug.Config) *Runtime
- func (r *Runtime) AddInst(path string, key *adt.Vertex, p *build.Instance)
- func (x *Runtime) Build(cfg *Config, b *build.Instance) (v *adt.Vertex, errs errors.Error)
- func (r *Runtime) BuildData(b *build.Instance) (x interface{}, ok bool)
- func (x *Runtime) BuiltinPackagePath(path string) string
- func (r *Runtime) Compile(cfg *Config, source interface{}) (*adt.Vertex, *build.Instance)
- func (r *Runtime) CompileFile(cfg *Config, file *ast.File) (*adt.Vertex, *build.Instance)
- func (r *Runtime) ConfigureOpCtx(ctx *adt.OpContext)
- func (r *Runtime) GetInstanceFromNode(key *adt.Vertex) *build.Instance
- func (r *Runtime) IndexToString(i int64) string
- func (r *Runtime) Init()
- func (r *Runtime) InjectImplementations(b *build.Instance, v *adt.Vertex) (errs errors.Error)
- func (r *Runtime) IsInitialized() bool
- func (r *Runtime) Label(s string, isIdent bool) adt.Feature
- func (r *Runtime) LabelStr(l adt.Feature) string
- func (r *Runtime) LoadImport(importPath string) *adt.Vertex
- func (x *Runtime) LoadType(t reflect.Type) (src ast.Expr, expr adt.Expr, ok bool)
- func (r *Runtime) NextUniqueID() uint64
- func (r *Runtime) ResolveFiles(p *build.Instance) (errs errors.Error)
- func (r *Runtime) SetBuildData(b *build.Instance, x interface{})
- func (r *Runtime) SetDebugOptions(flags *cuedebug.Config)
- func (r *Runtime) SetInterpreter(i Interpreter)
- func (r *Runtime) SetTopologicalSort(b bool)
- func (r *Runtime) SetVersion(v internal.EvaluatorVersion)
- func (r *Runtime) Settings() (internal.EvaluatorVersion, cuedebug.Config)
- func (x *Runtime) StoreType(t reflect.Type, src ast.Expr, expr adt.Expr)
- func (r *Runtime) StrLabel(str string) adt.Feature
- func (r *Runtime) StringToIndex(s string) int64
Variables ¶
var sync.OnceValue(func() *Runtime { r := &Runtime{index: sharedIndex} cueexperiment.Init() if cueexperiment.Flags.EvalV3 { r.version = internal.DevVersion } else { r.version = internal.DefaultVersion } return r })=
We use a sync.OnceValue below so that cueexperiment.Init is only called the first time that the API is used, letting the user set $CUE_EXPERIMENT globally as part of their package init if they want to.
Functions ¶
func RegisterBuiltin ¶
func RegisterBuiltin(importPath string, f PackageFunc)
Types ¶
type Compiler ¶
type Compiler interface { // Compile creates an adt.Expr (usually a builtin) for the // given external named resource (usually a function). name // is the name of the resource to compile, taken from altName // in `@extern(name=altName)`, or from the field name if that's // not defined. Scope is the struct that contains the field. // Other than "name", the fields in a are implementation // specific. Compile(name string, scope adt.Value, a *internal.Attr) (adt.Expr, errors.Error) }
A Compiler fills in an adt.Expr for fields marked with `@extern(kind)`.
type Config ¶
type Config struct { Runtime *Runtime Filename string ImportPath string Counts *stats.Counts compile.Config }
type Interpreter ¶
type Interpreter interface { // NewCompiler creates a compiler for b and reports any errors. NewCompiler(b *build.Instance, r *Runtime) (Compiler, errors.Error) // Kind returns the string to be used in the file-level @extern attribute. Kind() string }
Interpreter defines an entrypoint for creating per-package interpreters.
type PackageFunc ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
A Runtime maintains data structures for indexing and reuse for evaluation.
func New ¶
func New() *Runtime
New creates a new Runtime obeying the CUE_EXPERIMENT and CUE_DEBUG flags set via environment variables.
func NewWithSettings ¶
func NewWithSettings(v internal.EvaluatorVersion, flags cuedebug.Config) *Runtime
NewWithSettings creates a new Runtime using the given runtime version and debug flags. The builtins registered with RegisterBuiltin are available for evaluation.
func (*Runtime) AddInst ¶
func (*Runtime) Build ¶
Build builds b and all its transitive dependencies, insofar they have not been build yet.
func (*Runtime) BuildData ¶
func (*Runtime) BuiltinPackagePath ¶
BuiltinPackagePath converts a short-form builtin package identifier to its full path or "" if this doesn't exist.
func (*Runtime) Compile ¶
func (*Runtime) CompileFile ¶
func (*Runtime) ConfigureOpCtx ¶
func (*Runtime) GetInstanceFromNode ¶
func (*Runtime) IndexToString ¶
func (*Runtime) Init ¶
func (r *Runtime) Init()
func (*Runtime) InjectImplementations ¶
InjectImplementations modifies v to include implementations of functions for fields associated with the @extern attributes.
TODO(mvdan): unexport again once cue.Instance.Build is no longer used by `cue cmd` and can be removed entirely.
func (*Runtime) IsInitialized ¶
IsInitialized reports whether the runtime has been initialized.
func (*Runtime) Label ¶
func (*Runtime) LabelStr ¶
func (*Runtime) LoadImport ¶
func (*Runtime) LoadType ¶
func (*Runtime) NextUniqueID ¶
func (*Runtime) ResolveFiles ¶
TODO(resolve): this is also done in compile, do we need both?
func (*Runtime) SetBuildData ¶
func (*Runtime) SetDebugOptions ¶
SetDebugOptions sets the debug flags to use for the Runtime. This should only be set before first use.
func (*Runtime) SetInterpreter ¶
func (r *Runtime) SetInterpreter(i Interpreter)
SetInterpreter sets the interpreter for interpretation of files marked with @extern(kind).
func (*Runtime) SetTopologicalSort ¶
SetTopologicalSort sets whether or not to use topological sorting for the Runtime.
func (*Runtime) SetVersion ¶
func (r *Runtime) SetVersion(v internal.EvaluatorVersion)
SetVersion sets the version to use for the Runtime. This should only be set before first use.
func (*Runtime) Settings ¶
func (r *Runtime) Settings() (internal.EvaluatorVersion, cuedebug.Config)
func (*Runtime) StoreType ¶
func (*Runtime) StrLabel ¶
func (*Runtime) StringToIndex ¶
Source Files ¶
build.go errors.go extern.go go.go imports.go index.go resolve.go runtime.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 18 packages
- Last checked
- 5 hours ago –
Tools for package owners.