BigSaltyMan/cuesmith/eval does not have a README file

    AllowedSet

    pub(all) struct AllowedSet {
    fields : Array[String]
    patterns : Array[Value]
    allow_all : Bool
    } derive(Eq,
    Debug
    )

    One OR-clause in CUE's AND-of-ORs struct closedness model.

    BoundOp

    pub(all) enum BoundOp {
    Lt
    Le
    Gt
    Ge
    Neq
    } derive(Eq,
    Debug
    )

    Ordering and inequality bound operators supported by CUE constraints.

    BuiltinValidationResult

    pub(all) enum BuiltinValidationResult {
    Pass
    Fail(Array[CueError])
    Pending
    Unknown
    } derive(Eq,
    Debug
    )

    Outcome of evaluating a stdlib builtin validator constraint against a value.

    BytesBounds

    pub(all) struct BytesBounds {
    lower : (Bytes, Bool)?
    upper : (Bytes, Bool)?
    excluded : Array[Bytes]
    } derive(Eq,
    Debug
    )

    Canonical normalized lexicographical constraint bounds on CUE bytes values.

    BytesBounds::any

    Constructs an unconstrained BytesBounds representing bytes.

    BytesBounds::format

    fn BytesBounds::format(self : BytesBounds) -> String

    Formats a BytesBounds into canonical CUE display syntax.

    BytesBounds::from_bound

    fn BytesBounds::from_bound(op : BoundOp, val : Bytes) -> BytesBounds

    Constructs a BytesBounds from a single bound operator and bytes literal.

    BytesBounds::matches

    fn BytesBounds::matches(self : BytesBounds, val : Bytes) -> Result[Unit, String]

    Checks whether a concrete Bytes value satisfies all constraints in self.

    BytesBounds::unify

    fn BytesBounds::unify(self : BytesBounds, other : BytesBounds) -> Result[BytesBounds, String]

    Unifies two BytesBounds, returning the canonical intersection or an error if the constraints are contradictory.

    CompiledRegex

    pub struct CompiledRegex {
    // private fields
    } derive(Eq,
    Debug
    )

    A compiled ReDoS-safe Thompson NFA regular expression.

    Matching executes in linear O(states * chars) time with zero backtracking.

    CompiledRegex::find

    fn CompiledRegex::find(self : CompiledRegex, input : String) -> String?

    Finds the leftmost-first RE2 match of this compiled regex in input, executing in linear O(states * chars) time with zero backtracking.

    Explicitly distinguishes None (no match) from Some("") (empty match).

    CompiledRegex::find_with_budget

    fn CompiledRegex::find_with_budget(self : CompiledRegex, input : String, budget : EvalBudget) -> Result[String?, CueError]

    Finds the leftmost-first RE2 match of this compiled regex in input while charging NFA steps and output UTF-8 byte length against budget.

    CompiledRegex::is_match

    fn CompiledRegex::is_match(self : CompiledRegex, input : String) -> Bool

    Returns true if input matches this compiled regular expression (unanchored RE2 / CUE =~ substring semantics by default).

    CompiledRegex::is_match_with_budget

    fn CompiledRegex::is_match_with_budget(self : CompiledRegex, input : String, budget : EvalBudget) -> Result[Bool, CueError]

    Returns true if input matches this compiled regular expression while charging NFA execution steps against budget.

    CompiledRegex::pattern

    fn CompiledRegex::pattern(self : CompiledRegex) -> String

    Returns the original pattern string used to compile this regex.

    CueError

    pub(all) struct CueError {
    path : Array[String]
    kind : CueErrorKind
    message : String
    span :
    Span
    ?
    } derive(Eq,
    Debug
    )

    A structured CUE evaluation diagnostic carrying its field path and optional span.

    CueError::format

    fn CueError::format(self : CueError) -> String

    Formats the error including its path (if non-empty) and message.

    CueError::format_path

    fn CueError::format_path(self : CueError) -> String

    Formats the error's field path as dot-separated segments.

    CueError::new

    fn CueError::new(kind : CueErrorKind, message : String, span? :
    Span
    ) -> CueError

    Creates a CueError with an empty path and optional source span.

    CueError::with_prefix

    fn CueError::with_prefix(self : CueError, seg : String) -> CueError

    Returns a copy of this error with seg prepended to path.

    CueErrorKind

    pub(all) enum CueErrorKind {
    SyntaxError
    TypeConflict
    ValueConflict
    BoundsConflict
    RegexConflict
    FieldNotAllowed
    MissingRequired
    Incomplete
    AmbiguousDefault
    CycleError
    UndefinedRef
    InvalidOp
    ResourceLimit
    InvalidArg
    } derive(Eq,
    Debug
    )

    Category of evaluation error in the CUE value lattice.

    Decimal

    pub struct Decimal {
    coeff :
    BigInt

    exp : Int
    } derive(
    Debug
    )

    Arbitrary-precision base-10 floating-point number representing coeff * 10^exp, aligned with CUE's decimal arithmetic (apd.Decimal).

    Invariants maintained by all constructors and operations:
    • Zero is uniquely represented as { coeff: 0, exp: 0 }.
    • For non-zero values, coeff has no trailing base-10 zeros.
    • Adjusted exponent exp + digit_len(|coeff|) - 1 lies in [DECIMAL_MIN_EXP, DECIMAL_MAX_EXP].
    impl Eq for Decimal

    Decimal::abs

    fn Decimal::abs(self : Decimal) -> Decimal

    Returns the absolute value |self|.

    Decimal::add

    fn Decimal::add(self : Decimal, other : Decimal, max_digits? : Int) -> Result[Decimal, String]

    Exact base-10 addition self + other.

    Decimal::ceil

    fn Decimal::ceil(self : Decimal, max_digits? : Int) -> Result[
    BigInt
    , String]

    Exact mathematical ceiling ceil(self) as a BigInt.

    Decimal::coeff

    Returns the normalized integer coefficient of self.

    Decimal::compare

    fn Decimal::compare(self : Decimal, other : Decimal) -> Int

    Exact numerical comparison between two Decimals in O(len(a)+len(b)) without allocating pow10 even for huge exponent differences.

    Decimal::compare_bigint

    fn Decimal::compare_bigint(self : Decimal, n :
    BigInt
    ) -> Int

    Exact comparison between a Decimal and an arbitrary BigInt without precision loss or pow10 allocation.

    Decimal::div

    fn Decimal::div(self : Decimal, other : Decimal, precision? : Int) -> Result[Decimal, String]

    Base-10 division self / other rounded half-to-even to precision significant digits (default DECIMAL_DIV_PRECISION = 24, aligned with Go CUE's apd).

    Decimal::exp

    fn Decimal::exp(self : Decimal) -> Int

    Returns the normalized base-10 exponent of self.

    Decimal::floor

    fn Decimal::floor(self : Decimal, max_digits? : Int) -> Result[
    BigInt
    , String]

    Exact mathematical floor floor(self) as a BigInt.

    Decimal::format_cue

    fn Decimal::format_cue(self : Decimal) -> String

    Formats a Decimal into canonical lossless CUE (and RFC 8259 JSON) float syntax. Always includes either a decimal point . or scientific exponent e/E so float values remain syntactically distinct from Int.

    Decimal::format_json

    fn Decimal::format_json(self : Decimal) -> String

    Formats a Decimal into valid RFC 8259 JSON numeric syntax.

    Decimal::from_bigint

    Converts an exact BigInt to a normalized Decimal.

    Decimal::from_double

    fn Decimal::from_double(d : Double) -> Result[Decimal, String]

    Converts a finite IEEE-754 Double into an exact normalized Decimal, rejecting NaN and ±Inf and normalizing -0.0 to Decimal::zero().

    Decimal::from_parts

    fn Decimal::from_parts(coeff :
    BigInt
    , exp : Int) -> Result[Decimal, String]

    Constructs a normalized Decimal from an arbitrary coefficient and base-10 exponent.

    Decimal::is_exact_int

    fn Decimal::is_exact_int(self : Decimal) -> Bool

    Decimal::is_negative

    fn Decimal::is_negative(self : Decimal) -> Bool

    Decimal::is_positive

    fn Decimal::is_positive(self : Decimal) -> Bool

    Decimal::is_zero

    fn Decimal::is_zero(self : Decimal) -> Bool

    Decimal::mul

    fn Decimal::mul(self : Decimal, other : Decimal, max_digits? : Int) -> Result[Decimal, String]

    Exact base-10 multiplication self * other.

    Decimal::neg

    fn Decimal::neg(self : Decimal) -> Decimal

    Returns the additive inverse -self.

    Decimal::parse

    fn Decimal::parse(raw : String) -> Result[Decimal, String]

    Parses a validated decimal string (with optional leading +/-) using CUE's decimal rules (_, .5, 1., 1.e5, 2.5e-3).

    Decimal::round

    fn Decimal::round(self : Decimal, max_digits? : Int) -> Result[
    BigInt
    , String]

    Exact rounding half-away-from-zero (matching CUE math.Round / Go math.Round).

    Decimal::sub

    fn Decimal::sub(self : Decimal, other : Decimal, max_digits? : Int) -> Result[Decimal, String]

    Exact base-10 subtraction self - other.

    Decimal::to_double

    fn Decimal::to_double(self : Decimal) -> Result[Double, String]

    Converts a Decimal to the nearest IEEE-754 Double (used for floating-point transcendental math built-ins such as math.Sin and math.Sqrt).

    Decimal::trunc

    fn Decimal::trunc(self : Decimal, max_digits? : Int) -> Result[
    BigInt
    , String]

    Exact mathematical truncation toward zero as a BigInt.

    Decimal::zero

    fn Decimal::zero() -> Decimal

    Returns the canonical zero Decimal (0.0).

    Disjunct

    pub(all) struct Disjunct {
    value : Value
    is_default : Bool
    } derive(Eq,
    Debug
    )

    One branch of a CUE disjunction, optionally marked as default (*).

    DisjunctionValue

    pub(all) struct DisjunctionValue {
    items : Array[Disjunct]
    default_eliminated : Bool
    } derive(Eq,
    Debug
    )

    Canonical CUE disjunction value with branch list and default-elimination tracking.

    DisjunctionValue::new

    fn DisjunctionValue::new(items : Array[Disjunct], default_eliminated? : Bool) -> DisjunctionValue

    Constructs a DisjunctionValue with default_eliminated defaulting to false.

    EvalBudget

    pub struct EvalBudget {
    // private fields
    }

    Mutable runtime budget tracker enforcing EvalLimits during evaluation.
    impl Eq for EvalBudget

    EvalBudget::check_branches

    fn EvalBudget::check_branches(self : EvalBudget, count : Int) -> Result[Unit, LimitError]

    Checks whether a disjunction branch count fits within max_disjunction_branches.

    EvalBudget::check_output_bytes

    fn EvalBudget::check_output_bytes(self : EvalBudget, byte_len : Int) -> Result[Unit, LimitError]

    Checks whether an output byte length fits within max_output_bytes.

    EvalBudget::check_source_bytes

    fn EvalBudget::check_source_bytes(self : EvalBudget, byte_len : Int) -> Result[Unit, LimitError]

    Checks whether an input source byte length fits within max_source_bytes.

    EvalBudget::consume_step

    fn EvalBudget::consume_step(self : EvalBudget) -> Result[Unit, LimitError]

    Consumes one evaluation step, failing if max_eval_steps would be exceeded.

    EvalBudget::current_depth

    fn EvalBudget::current_depth(self : EvalBudget) -> Int

    Returns the current nesting depth tracked by this budget.

    EvalBudget::enter_depth

    fn EvalBudget::enter_depth(self : EvalBudget) -> Result[Unit, LimitError]

    Enters one level of nesting, failing if max_depth would be exceeded.

    On Err, the recorded depth is not incremented.

    EvalBudget::leave_depth

    fn EvalBudget::leave_depth(self : EvalBudget) -> Unit

    Leaves one level of nesting, saturating at 0.

    EvalBudget::limits

    fn EvalBudget::limits(self : EvalBudget) -> EvalLimits

    Returns the EvalLimits configured for this budget.

    EvalBudget::new

    fn EvalBudget::new(limits : EvalLimits) -> EvalBudget

    Creates a fresh EvalBudget with the provided EvalLimits.

    EvalBudget::steps_used

    fn EvalBudget::steps_used(self : EvalBudget) -> Int

    Returns the number of evaluation steps consumed so far.

    EvalConfig

    pub(all) struct EvalConfig {
    limits : EvalLimits
    pkg_resolver : (String, String, Array[Value], EvalBudget) -> Value??
    pkg_value_resolver : (String, String, EvalBudget) -> Value??
    validator_resolver : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult?
    package_deps : Array[PackageUnit]
    tags : Map[String, String?]
    }

    Full evaluation configuration supporting resource limits, stdlib function resolver, stdlib constant/member value resolver, builtin validator resolver, and pre-parsed package dependencies.

    EvalConfig::default

    fn EvalConfig::default() -> EvalConfig

    Returns default evaluation configuration with default limits and no resolvers.

    EvalConfig::from_options

    fn EvalConfig::from_options(options : EvalOptions) -> EvalConfig

    Converts legacy EvalOptions into an EvalConfig.

    EvalConfig::new

    fn EvalConfig::new(limits? : EvalLimits, pkg_resolver? : (String, String, Array[Value], EvalBudget) -> Value?, pkg_value_resolver? : (String, String, EvalBudget) -> Value?, validator_resolver? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult, package_deps? : Array[PackageUnit], tags? : Map[String, String?]) -> EvalConfig

    Constructs an EvalConfig with optional limits, resolver callbacks, pre-parsed package dependencies, and explicit @tag injections.

    EvalConfig::with_package_deps

    fn EvalConfig::with_package_deps(self : EvalConfig, package_deps : Array[PackageUnit]) -> EvalConfig

    Returns a copy of self with package_deps replaced.

    EvalConfig::with_tags

    fn EvalConfig::with_tags(self : EvalConfig, tags : Map[String, String?]) -> EvalConfig

    Returns a copy of self with explicit @tag injections replaced.

    EvalLimits

    pub(all) struct EvalLimits {
    max_source_bytes : Int
    max_ast_nodes : Int
    max_eval_steps : Int
    max_depth : Int
    max_disjunction_branches : Int
    max_output_bytes : Int
    } derive(Eq,
    Debug
    )

    Bounded resource limits for safe CUE parsing, evaluation, and export.

    The defaults are chosen to protect against pathological inputs such as disjunction explosion, deep nesting (safe on Windows 1 MB native debug stacks), huge ASTs, and unbounded output expansion.

    EvalLimits::default

    fn EvalLimits::default() -> EvalLimits

    Returns the default safe EvalLimits configuration.

    EvalOptions

    pub(all) struct EvalOptions {
    limits : EvalLimits
    pkg_resolver : (String, String, Array[Value], EvalBudget) -> Value??
    }

    Evaluation options combining resource limits and an optional stdlib package resolver.

    EvalOptions::default

    fn EvalOptions::default() -> EvalOptions

    Returns default evaluation options with default limits and no package resolver.

    LimitError

    pub(all) enum LimitError {
    SourceBytesExceeded(Int, Int)
    AstNodesExceeded(Int, Int)
    EvalStepsExceeded(Int, Int)
    MaxDepthExceeded(Int, Int)
    DisjunctionBranchesExceeded(Int, Int)
    OutputBytesExceeded(Int, Int)
    } derive(Eq,
    Debug
    )

    Diagnostic error returned when an EvalLimits guardrail is exceeded.

    Each variant stores (actual, limit).

    LimitError::message

    fn LimitError::message(self : LimitError) -> String

    Formats a LimitError as a human-readable diagnostic message.

    ListValue

    pub(all) struct ListValue {
    elems : Array[Value]
    tail : Value?
    } derive(Eq,
    Debug
    )

    A CUE list value: fixed prefix elements plus optional open tail element constraint.

    NumBounds

    pub(all) struct NumBounds {
    kind : NumKind
    lower : (NumValue, Bool)?
    upper : (NumValue, Bool)?
    excluded : Array[NumValue]
    } derive(Eq,
    Debug
    )

    Canonical normalized numeric constraint bounds in the CUE value lattice.

    Invariants maintained by all constructors and unify:
    • All stored Float values are finite and -0.0 is normalized to 0.0.
    • When kind == Int, lower and upper (if present) are always inclusive Int(BigInt) values, and excluded contains only strictly interior sorted unique Int(BigInt) values (endpoints are tightened past excluded boundary integers).
    • When kind is Number or Float, excluded is sorted ascending by compare_num, deduplicated (preferring Int on ties), and contains only values strictly inside (lower, upper); any excluded value equal to an inclusive endpoint tightens that endpoint to exclusive.

    NumBounds::format

    fn NumBounds::format(self : NumBounds) -> String

    Formats a NumBounds into canonical CUE display syntax (for example int & >=1 & <=65535).

    NumBounds::from_bound

    fn NumBounds::from_bound(op : BoundOp, val : NumValue) -> Result[NumBounds, String]

    Constructs a NumBounds from a single unary bound operator and value.

    The resulting NumBounds has kind = Number (per CUE semantics, numeric bounds like >=1 or >=1.5 accept both int and float until narrowed).

    NumBounds::matches

    fn NumBounds::matches(self : NumBounds, val : NumValue) -> Result[Unit, String]

    Checks whether a concrete NumValue satisfies all constraints in self.

    NumBounds::of_kind

    fn NumBounds::of_kind(kind : NumKind) -> NumBounds

    Constructs an unconstrained NumBounds of the given NumKind.

    NumBounds::unify

    fn NumBounds::unify(self : NumBounds, other : NumBounds) -> Result[NumBounds, String]

    Unifies two NumBounds, returning the canonical tightened intersection or an error if the bounds contradict each other.

    NumKind

    pub(all) enum NumKind {
    Number
    Int
    Float
    } derive(Eq,
    Debug
    )

    Numeric type kind in the CUE value lattice.

    NumKind::format

    fn NumKind::format(self : NumKind) -> String

    Formats a NumKind as its canonical CUE keyword (number, int, float).

    NumKind::unify

    fn NumKind::unify(self : NumKind, other : NumKind) -> NumKind?

    Unifies two numeric kinds (Number & Int = Int, Number & Float = Float, Int & Float = None).

    NumValue

    A concrete CUE numeric value preserving the distinction between exact arbitrary-precision Int(BigInt) and arbitrary-precision decimal Float(Decimal).
    impl Eq for NumValue

    NumValue::decimal

    fn NumValue::decimal(d : Decimal) -> NumValue

    Constructs a NumValue::Float directly from an exact normalized Decimal.

    NumValue::float

    fn NumValue::float(d : Double) -> Result[NumValue, String]

    Constructs a validated finite NumValue::Float from a Double, rejecting NaN and ±Inf and normalizing -0.0 to 0.0.

    NumValue::format

    fn NumValue::format(self : NumValue) -> String

    Formats a NumValue into valid CUE numeric syntax (Float always includes a decimal point or exponent so it stays distinguishable from Int).

    NumValue::int

    Constructs a NumValue::Int from a BigInt.

    NumValue::kind

    fn NumValue::kind(self : NumValue) -> NumKind

    Returns the concrete NumKind (Int or Float) of a NumValue.

    PackageUnit

    pub(all) struct PackageUnit {
    import_path : String
    pkg_name : String
    files : Array[
    File
    ]
    } derive(Eq,
    Debug
    )

    A pre-parsed CUE package unit for cross-package import resolution.

    PatternConstraint

    pub(all) struct PatternConstraint {
    key_constraint : Value
    value_constraint : Value
    alias_name : String?
    } derive(Eq,
    Debug
    )

    A pattern constraint [key_constraint]: value_constraint on a struct.

    RegexConstraints

    pub(all) struct RegexConstraints {
    positive : Array[String]
    negative : Array[String]
    } derive(Eq,
    Debug
    )

    Normalized conjunction of CUE regex match (=~) and non-match (!~) constraints.

    Both positive and negative are stored in sorted, deduplicated order so structural equality satisfies lattice commutativity, associativity, and idempotence.

    RegexConstraints::empty

    Returns an empty RegexConstraints with no match or non-match restrictions.

    RegexConstraints::format

    fn RegexConstraints::format(self : RegexConstraints) -> String

    Formats these regex constraints in canonical CUE syntax, e.g. =~"^a" & !~"bad". Returns "" when empty.

    RegexConstraints::from_match

    fn RegexConstraints::from_match(pattern : String) -> Result[RegexConstraints, String]

    Creates a RegexConstraints requiring =~ pattern, validating that pattern compiles.

    RegexConstraints::from_not_match

    fn RegexConstraints::from_not_match(pattern : String) -> Result[RegexConstraints, String]

    Creates a RegexConstraints requiring !~ pattern, validating that pattern compiles.

    RegexConstraints::is_empty

    fn RegexConstraints::is_empty(self : RegexConstraints) -> Bool

    Returns true if there are no positive or negative regex constraints.

    RegexConstraints::matches

    fn RegexConstraints::matches(self : RegexConstraints, input : String) -> Result[Unit, String]

    Checks that input matches every positive pattern and does not match any negative pattern.

    RegexConstraints::unify

    Unifies two RegexConstraints by merging their normalized positive and negative pattern sets, failing if any exact pattern appears in both.

    ResourceScanResult

    pub(all) enum ResourceScanResult {
    Found(CueError)
    Clean
    Exhausted
    } derive(Eq,
    Debug
    )

    Outcome of scanning a Value subtree for embedded ResourceLimit errors.

    SchemaSession

    pub struct SchemaSession {
    // private fields
    }

    Stateful schema evaluation session retaining the originating Evaluator context (deferred recursive optional-field templates and aliased pattern bindings), cumulative AST node count, and shared EvalBudget.

    SchemaSession::budget

    fn SchemaSession::budget(self : SchemaSession) -> EvalBudget

    Returns the EvalBudget shared by this session.

    SchemaSession::from_file

    Creates a SchemaSession by evaluating a single @syntax.File AST with config and optional shared budget.

    SchemaSession::from_files

    Creates a SchemaSession by evaluating multiple @syntax.File ASTs in a shared package scope with config and optional shared budget.

    SchemaSession::from_files_expr

    Creates a SchemaSession by evaluating expr inside the shared package scope of files with config and optional shared budget.

    SchemaSession::from_sources

    fn SchemaSession::from_sources(sources : Array[String], config : EvalConfig, budget? : EvalBudget) -> SchemaSession

    Creates a SchemaSession by parsing and evaluating sources in a shared package scope with config and optional shared budget, checking cumulative UTF-8 source bytes against budget.limits().max_source_bytes.

    SchemaSession::resolve_default

    fn SchemaSession::resolve_default(self : SchemaSession) -> SchemaSession

    Resolves defaults on the session's active schema using this session's Evaluator context so deferred recursive templates inside matchN and list.MatchN are preserved.

    SchemaSession::resolve_for_concrete

    fn SchemaSession::resolve_for_concrete(self : SchemaSession) -> Value

    Resolves defaults and evaluates concrete validator constraints (matchN and list.MatchN) within this session's Evaluator context, returning a value ready for structural concreteness checking.

    SchemaSession::select_def

    Checks root schema errors first, then selects the exact (def_name, kind) top-level field as the session's active schema while preserving its Evaluator context.

    SchemaSession::unify_expr

    Evaluates standalone data_expr in an isolated fresh root scope (checking cumulative AST nodes against max_ast_nodes) and unifies it with the session schema, returning an updated SchemaSession.

    SchemaSession::unify_file

    fn SchemaSession::unify_file(self : SchemaSession, data_file :
    File
    , tags? : Map[String, String?]) -> SchemaSession

    Evaluates data_file in an isolated fresh root scope sharing this session's preloaded package_deps (checking cumulative AST nodes against max_ast_nodes) and unifies it with the session schema, returning an updated SchemaSession.

    SchemaSession::validate_schema

    fn SchemaSession::validate_schema(self : SchemaSession) -> Result[SchemaSession, Array[CueError]]

    Validates determined constraints on the session schema and rejects any root or nested errors before data unification.

    SchemaSession::value

    fn SchemaSession::value(self : SchemaSession) -> Value

    Returns a deeply detached snapshot of the schema Value held by this session.

    StringBounds

    pub(all) struct StringBounds {
    lower : (String, Bool)?
    upper : (String, Bool)?
    excluded : Array[String]
    } derive(Eq,
    Debug
    )

    Canonical normalized lexicographical constraint bounds on CUE string values.

    StringBounds::any

    Constructs an unconstrained StringBounds representing string.

    StringBounds::format

    fn StringBounds::format(self : StringBounds) -> String

    Formats a StringBounds into canonical CUE display syntax.

    StringBounds::from_bound

    fn StringBounds::from_bound(op : BoundOp, val : String) -> StringBounds

    Constructs a StringBounds from a single bound operator and string literal.

    StringBounds::matches

    fn StringBounds::matches(self : StringBounds, val : String) -> Result[Unit, String]

    Checks whether a concrete String satisfies all constraints in self.

    StringBounds::unify

    fn StringBounds::unify(self : StringBounds, other : StringBounds) -> Result[StringBounds, String]

    Unifies two StringBounds, returning the canonical intersection or an error if the constraints are contradictory.

    StructField

    A single field entry inside a StructValue.

    StructValue

    pub(all) struct StructValue {
    fields : Array[StructField]
    patterns : Array[PatternConstraint]
    closed_rules : Array[AllowedSet]
    allow_ellipsis : Bool
    deferred_ids : Array[Int]
    } derive(Eq,
    Debug
    )

    Canonical CUE struct value with fields, pattern constraints, and closedness rules.

    StructValue::allowed_set_from_literal

    fn StructValue::allowed_set_from_literal(self : StructValue) -> AllowedSet

    Builds an AllowedSet representing the fields and pattern constraints declared on self.

    StructValue::normalized

    fn StructValue::normalized(fields : Array[StructField], patterns : Array[PatternConstraint], closed_rules : Array[AllowedSet], allow_ellipsis : Bool, deferred_ids? : Array[Int]) -> StructValue

    Constructs a canonically normalized StructValue.

    SubsumesOptions

    pub(all) struct SubsumesOptions {
    final_mode : Bool
    ignore_closed : Bool
    } derive(Eq,
    Debug
    )

    Options controlling CUE lattice subsumption (subsumes_with_options).

    SubsumesOptions::default

    Returns the default SubsumesOptions (final_mode: false, ignore_closed: false).

    ValidatorConstraint

    pub(all) enum ValidatorConstraint {
    MatchN(Value, Array[Value])
    Builtin(String, String, Array[Value])
    } derive(Eq,
    Debug
    )

    A deferred validator constraint attached to a Value (such as matchN or stdlib validators).

    Value

    pub(all) enum Value {
    Top
    Bottom(Array[CueError])
    Null
    BoolKind
    Bool(Bool)
    NumKind(NumBounds)
    Int(
    BigInt
    )
    Float(Decimal)
    StringKind(StringBounds, RegexConstraints)
    String(String)
    BytesKind(BytesBounds)
    Bytes(Bytes)
    Struct(StructValue)
    List(ListValue)
    Disjunction(DisjunctionValue)
    Constrained(Value, Array[ValidatorConstraint])
    } derive(Eq,
    Debug
    )

    Core CUE value lattice representation.

    Value::decimal

    fn Value::decimal(d : Decimal) -> Value

    Constructs a Value::Float directly from a normalized arbitrary-precision Decimal.

    Value::errors

    fn Value::errors(self : Value) -> Array[CueError]

    Returns the error list if self is Bottom, or an empty array otherwise.

    Value::float

    fn Value::float(d : Double) -> Value

    Constructs a validated finite Value::Float from a Double, rejecting NaN/±Inf and normalizing -0.0 to 0.0.

    Value::is_bottom

    fn Value::is_bottom(self : Value) -> Bool

    Returns true if self is Bottom.

    Value::is_top

    fn Value::is_top(self : Value) -> Bool

    Returns true if self is Top.

    DECIMAL_DIV_PRECISION

    let DECIMAL_DIV_PRECISION : Int

    DECIMAL_MAX_EXP

    let DECIMAL_MAX_EXP : Int

    DECIMAL_MAX_SCALE_OP

    let DECIMAL_MAX_SCALE_OP : Int

    DECIMAL_MIN_EXP

    let DECIMAL_MIN_EXP : Int

    bottom_err

    fn bottom_err(kind : CueErrorKind, message : String, span? :
    Span
    ) -> Value

    Constructs a Bottom value containing a single CueError.

    ceil_to_bigint

    fn ceil_to_bigint(d : Double) ->
    BigInt

    Returns the exact mathematical ceiling of a finite Double as a BigInt.

    check_struct_closedness

    fn check_struct_closedness(s : StructValue, budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Value

    Validates that every regular non-optional field in s is permitted by every AllowedSet in s.closed_rules (hidden fields and definitions are exempt). Handles unsorted AllowedSet.fields safely by sorting unsorted rules at most once.

    close_value

    fn close_value(val : Value, budget : EvalBudget) -> Value

    Recursively closes structs inside val, honoring budget nesting limits.

    collect_errors

    fn collect_errors(val : Value) -> Array[CueError]

    Iteratively collects all Bottom errors across structs, lists, single-branch disjunctions, and constrained values with full dot-paths, canonically sorted and deduplicated.

    compare_cue_bytes

    fn compare_cue_bytes(a : Bytes, b : Bytes) -> Int

    Compares two byte sequences lexicographically byte-by-byte (unsigned), returning -1, 0, or +1.

    compare_cue_string

    fn compare_cue_string(a : String, b : String) -> Int

    Compares two strings lexicographically by Unicode scalar value (identical to UTF-8 byte lexicographical order as specified by CUE), returning -1, 0, or +1.

    compare_num

    fn compare_num(a : NumValue, b : NumValue) -> Int

    Compares two NumValues numerically, returning -1, 0, or +1.

    Cross-type comparison between Int(BigInt) and Float(Decimal) is exact (never rounds through IEEE-754 Double), so 2^53 + 1 > Float(2^53) and compare_num(Int(1), Float(Decimal("1.0"))) == 0.

    compile_regex

    fn compile_regex(pattern : String) -> Result[CompiledRegex, String]

    Compiles a regular expression pattern into a linear-time Thompson NFA.

    Rejects invalid syntax and patterns that exceed bounded compilation limits.

    compile_regex_with_budget

    fn compile_regex_with_budget(pattern : String, budget : EvalBudget) -> Result[CompiledRegex, CueError]

    Compiles a regular expression pattern into a linear-time Thompson NFA while accounting parsing and compilation steps against budget.

    count_expr_ast_nodes

    fn count_expr_ast_nodes(expr :
    Expr
    , max_nodes : Int) -> Result[Int, LimitError]

    Counts all AST nodes in a @syntax.Expr, short-circuiting as soon as max_nodes is exceeded. Uses an explicit worklist so deeply nested ASTs cannot overflow the call stack.

    count_file_ast_nodes

    fn count_file_ast_nodes(file :
    File
    , max_nodes : Int) -> Result[Int, LimitError]

    Counts all AST nodes in a @syntax.File, short-circuiting as soon as max_nodes is exceeded. Uses an explicit worklist so deeply nested ASTs cannot overflow the call stack.

    dedup_sorted_errors

    fn dedup_sorted_errors(errs : Array[CueError]) -> Array[CueError]

    Returns a canonically sorted, deduplicated copy of errs in O(n log n) time.

    eval_expr

    fn eval_expr(expr :
    Expr
    , limits? : EvalLimits) -> Value

    Evaluates a standalone @syntax.Expr AST into a CUE Value.

    eval_expr_with_config

    fn eval_expr_with_config(expr :
    Expr
    , config : EvalConfig) -> Value

    Evaluates a standalone @syntax.Expr AST into a CUE Value using config.

    eval_expr_with_options

    fn eval_expr_with_options(expr :
    Expr
    , options : EvalOptions) -> Value

    Evaluates a standalone @syntax.Expr AST into a CUE Value using options.

    eval_file

    fn eval_file(file :
    File
    , limits? : EvalLimits) -> Value

    Evaluates a parsed @syntax.File AST into a CUE Value.

    eval_file_with_config

    fn eval_file_with_config(file :
    File
    , config : EvalConfig) -> Value

    Evaluates a parsed @syntax.File AST into a CUE Value using config.

    eval_file_with_options

    fn eval_file_with_options(file :
    File
    , options : EvalOptions) -> Value

    Evaluates a parsed @syntax.File AST into a CUE Value using options.

    eval_files

    fn eval_files(files : Array[
    File
    ], limits? : EvalLimits) -> Value

    Evaluates multiple parsed @syntax.File ASTs belonging to the same package.

    Package-level fields and definitions are shared across files while let bindings remain file-scoped and each file's closedness conjunct is unified via conjunction.

    eval_files_expr_with_config

    fn eval_files_expr_with_config(files : Array[
    File
    ], expr :
    Expr
    , config : EvalConfig) -> Value

    Evaluates expr inside the shared package scope of files using config.

    Counts AST nodes cumulatively across all files and expr against config.limits.max_ast_nodes. Package-level fields, definitions, expanded comprehensions, and root embeddings are visible to expr, while each file's let bindings and import aliases remain isolated to that file.

    eval_files_with_config

    fn eval_files_with_config(files : Array[
    File
    ], config : EvalConfig) -> Value

    Evaluates multiple parsed @syntax.File ASTs belonging to the same package using config.

    eval_files_with_options

    fn eval_files_with_options(files : Array[
    File
    ], options : EvalOptions) -> Value

    Evaluates multiple parsed @syntax.File ASTs belonging to the same package using options.

    eval_list_matchn_predicate

    fn eval_list_matchn_predicate(raw_xs : Value, raw_count : Value, schema_val : Value, budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Value

    Evaluates the 3-argument list.MatchN(list, count, schema) predicate, using the active evaluator context on budget when invoked inside Evaluator.

    eval_list_matchn_validator

    fn eval_list_matchn_validator(cand : Value, args : Array[Value], budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> BuiltinValidationResult

    Validates 2-argument list.MatchN(count, schema) against cand, using the active evaluator context on budget when invoked inside Evaluator.

    eval_package_graph_with_config

    fn eval_package_graph_with_config(deps : Array[PackageUnit], root_files : Array[
    File
    ], config : EvalConfig, expr? :
    Expr
    ) -> Value

    Evaluates a root package root_files (or optional expr) with topological dependency packages deps preloaded into config.

    eval_source

    fn eval_source(source : String, limits? : EvalLimits) -> Value

    Parses and evaluates a single CUE source string into a CUE Value.

    eval_source_with_config

    fn eval_source_with_config(source : String, config : EvalConfig) -> Value

    Parses and evaluates a single CUE source string into a CUE Value using config.

    eval_source_with_options

    fn eval_source_with_options(source : String, options : EvalOptions) -> Value

    Parses and evaluates a single CUE source string into a CUE Value using options.

    eval_sources

    fn eval_sources(sources : Array[String], limits? : EvalLimits) -> Value

    Parses and evaluates multiple CUE source strings in the same package.

    eval_sources_expr_with_config

    fn eval_sources_expr_with_config(sources : Array[String], expr_source : String, config : EvalConfig) -> Value

    Parses and evaluates expr_source inside the shared package scope of sources using config.

    Enforces config.limits.max_source_bytes cumulatively across all sources and expr_source, and config.limits.max_ast_nodes cumulatively across all parsed files and the parsed expression.

    eval_sources_with_config

    fn eval_sources_with_config(sources : Array[String], config : EvalConfig) -> Value

    Parses and evaluates multiple CUE source strings in the same package using config.

    eval_sources_with_options

    fn eval_sources_with_options(sources : Array[String], options : EvalOptions) -> Value

    Parses and evaluates multiple CUE source strings in the same package using options.

    first_resource_limit_error

    fn first_resource_limit_error(errs : Array[CueError]) -> CueError?

    Returns the first ResourceLimit diagnostic in errs, if any.

    floor_to_bigint

    fn floor_to_bigint(d : Double) ->
    BigInt

    Returns the exact mathematical floor of a finite Double as a BigInt.

    is_deeply_concrete

    fn is_deeply_concrete(val : Value, budget : EvalBudget) -> Result[Bool, CueError]

    Returns Ok(true) iff val is deeply concrete: finite concrete scalars, structs with all Regular && Normal fields deeply concrete and zero Required fields, and lists with all prefix elements deeply concrete. Returns Ok(false) for Top, kinds, Disjunction, Constrained, and non-limit Bottom; propagates ResourceLimit as Err.

    make_constrained

    fn make_constrained(base : Value, constraints : Array[ValidatorConstraint], budget : EvalBudget) -> Value

    Attaches validator constraints (such as matchN) onto base in canonical form.

    Flattens nested Constrained wrappers, distributes across Disjunction branches (preserving is_default and default_eliminated), narrows matchN counts to the int domain, and canonically sorts & deduplicates constraints. Does NOT evaluate or strip constraints early, preserving & associativity.

    make_disjunction

    fn make_disjunction(items : Array[Disjunct], budget : EvalBudget) -> Value

    Builds a canonical Disjunction value from items.

    Flattens nested disjunctions, discards Bottom branches (propagating ResourceLimit errors immediately and merging all errors if every branch fails), deduplicates equal branches (OR-ing is_default), canonically sorts surviving branches, enforces budget.check_branches, and collapses a single surviving branch to its inner value.

    make_disjunction_with_flag

    fn make_disjunction_with_flag(items : Array[Disjunct], input_had_default : Bool, budget : EvalBudget) -> Value

    Builds a canonical Disjunction value from items, tracking whether any contributing disjunction had marked defaults (even if eliminated by conflict).

    merge_errors

    fn merge_errors(a : Array[CueError], b : Array[CueError]) -> Array[CueError]

    Merges two error lists, preserving canonical sorted unique order in O(n log n) time.

    normalize_bottom_errors

    fn normalize_bottom_errors(errs : Array[CueError]) -> Array[CueError]

    Ensures a Bottom error list is never empty.

    parse_decimal_literal

    fn parse_decimal_literal(raw : String) -> Result[Decimal, String]

    Parses an unsigned CUE floating-point literal into an exact normalized arbitrary-precision Decimal.

    Supports _ separators, trailing dot (0., 1., 1.e5), leading dot (.5, .5e-3), and exponents (1e5, 2.5e-3), rejecting malformed literals, NaN, Infinity, leading -, and exponent overflow/underflow.

    parse_float_literal

    fn parse_float_literal(raw : String) -> Result[Double, String]

    Parses a CUE floating-point literal into a finite Double.

    Supports _ separators, trailing dot (0., 1., 1.e5), leading dot (.5, .5e-3), and exponents (1e5, 2.5e-3). Rejects malformed literals as well as NaN and ±Inf overflow, normalizing -0.0 to 0.0.

    parse_int_literal

    fn parse_int_literal(raw : String) -> Result[
    BigInt
    , String]

    Parses a CUE integer literal into an exact BigInt.

    Supports decimal, _ digit separators, 0x/0X, 0o/0O, 0b/0B, and CUE SI/IEC multipliers (K/M/G/T/P and Ki/Mi/Gi/Ti/Pi), including decimal-dot SI/IEC forms such as 1.5K, 1.5Ki, .5K, and 256Mi. Rejects malformed literals and fractional SI/IEC values that do not evaluate to an exact integer (such as 1.1Ki).

    predeclared_num_bounds

    fn predeclared_num_bounds(name : String) -> NumBounds?

    Returns the predeclared CUE numeric constraint for standard built-in numeric type identifiers (number, int, float, uint, uint8, int8, uint16, int16, uint32, int32, rune, uint64, int64, uint128, int128, float32, float64), or None for any other name.

    regex_find

    fn regex_find(pattern : String, input : String) -> Result[String?, String]

    Compiles pattern and finds the leftmost-first match in input.

    regex_find_with_budget

    fn regex_find_with_budget(pattern : String, input : String, budget : EvalBudget) -> Result[String?, CueError]

    Compiles pattern and finds the leftmost-first match in input, enforcing budget.

    regex_match

    fn regex_match(pattern : String, input : String) -> Result[Bool, String]

    Compiles pattern and tests whether it matches input.

    regex_match_with_budget

    fn regex_match_with_budget(pattern : String, input : String, budget : EvalBudget) -> Result[Bool, CueError]

    Compiles pattern and tests whether it matches input, enforcing budget.

    resolve_default

    fn resolve_default(val : Value, budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Value

    Resolves marked default branches in disjunctions recursively across structs, lists, and constrained values.

    • Scans all branches for embedded ResourceLimit before discarding non-defaults.
    • Prunes branches failing concrete validator constraints BEFORE selecting defaults.
    • Unique surviving marked default -> selects that branch (recursively resolved).
    • Multiple distinct surviving marked defaults -> Bottom(AmbiguousDefault).
    • No surviving marked defaults -> keeps the disjunction with resolved branches.

    scan_constraints_resource_limit

    fn scan_constraints_resource_limit(constraints : Array[ValidatorConstraint], max_visits : Int, max_depth : Int) -> ResourceScanResult

    Scans an array of ValidatorConstraint for any embedded ResourceLimit diagnostic using a single shared iterative stack and max_visits budget.

    scan_resource_limit

    fn scan_resource_limit(val : Value, max_visits : Int, max_depth : Int) -> ResourceScanResult

    Iteratively scans val for any embedded ResourceLimit diagnostic using an explicit stack, stopping cleanly with Exhausted if max_visits or max_depth is reached.

    subsumes

    fn subsumes(a : Value, b : Value, budget : EvalBudget) -> Result[Bool, CueError]

    Checks CUE lattice subsumption b ⊑ a ("a subsumes b") with default options.

    Enforces step and depth limits in budget, returning Err(CueError) with ResourceLimit if exhausted.

    subsumes_with_options

    fn subsumes_with_options(a : Value, b : Value, budget : EvalBudget, options? : SubsumesOptions, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Result[Bool, CueError]

    Checks CUE lattice subsumption b ⊑ a ("a subsumes b") with explicit options and optional builtin validator resolver.

    unify

    fn unify(a : Value, b : Value, budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Value

    Lattice meet (&) on two CUE values.

    Satisfies commutativity, associativity, idempotence, Top identity, and Bottom absorption while enforcing budget step, depth, and branch limits.

    unify_disjunction

    fn unify_disjunction(a : Value, b : Value, budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Value

    Distributive meet for disjunctions: (A | B) & C == (A & C) | (B & C), preserving CUE's exact default propagation rule default(D1 & D2) = default(D1) & default(D2).

    validate_constraints_value

    fn validate_constraints_value(candidate : Value, constraints : Array[ValidatorConstraint], budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Result[Value, Array[CueError]]

    Alias for validate_matchn_value validating all attached ValidatorConstraints.

    validate_determined_constraints

    fn validate_determined_constraints(val : Value, budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Value

    Validates determined builtin constraints across val without resolving defaults or requiring full concreteness.

    Leaves incomplete/open schemas and multi-branch disjunctions intact while turning determined Fail/Unknown builtin constraints into Bottom at their exact field/element location so collect_errors reports full paths.

    validate_matchn_value

    fn validate_matchn_value(candidate : Value, constraints : Array[ValidatorConstraint], budget : EvalBudget, validator? : (String, String, Array[Value], Value, EvalBudget) -> BuiltinValidationResult) -> Result[Value, Array[CueError]]

    Validates a concrete candidate against all attached validator constraints (matchN and stdlib Builtin validators).