pub enum DataDefinition {
Value {
value: LiteralValue,
source: Source,
},
TypeDeclaration {
resolved_type: Arc<LemmaType>,
declared_default: Option<ValueKind>,
source: Source,
},
Import {
spec: Arc<LemmaSpec>,
source: Source,
},
Reference {
target: ReferenceTarget,
resolved_type: Arc<LemmaType>,
local_constraints: Option<Vec<(TypeConstraintCommand, Vec<CommandArg>)>>,
local_default: Option<ValueKind>,
source: Source,
},
}Expand description
Resolved data value for the execution plan: aligned with DataValue but with source per variant.
Variants§
Value
Value-holding data: current value (literal or default); type is on the value.
TypeDeclaration
Type-only data: schema known, value to be supplied (e.g. via with_values).
declared_default carries the -> default ... payload for this binding or
the default inherited from the parent type chain, if any; value-promoting code
uses it instead of re-deriving defaults from TypeSpecification.
Import
Import (uses): resolved target lemma for this alias.
Reference
Value-copy reference to another data or a rule result.
resolved_type is the merged type that the copied value must satisfy at
evaluation time. Merging folds together: (1) the LHS’s own declared type,
if any; (2) the target’s type (data schema type or rule return type);
(3) any local_constraints written after the -> on the reference itself.
Merging happens in a dedicated pass once all data and rule types are
known; before that pass, resolved_type holds a provisional value and
must not be consumed for type checking.
local_constraints preserves the raw constraint list from the reference’s
-> ... tail (e.g. minimum 5 in data license2: law.other -> minimum 5)
for that merging pass. It is None when the reference has no trailing
constraints.
local_default carries any default <value> constraint from the
reference’s -> ... tail. The reference-merge pass extracts it from the
constraint list during type resolution. It is materialized into a
concrete value by the evaluator when the caller does not supply a value.
The reference itself is evaluated by copying the target’s value (data path)
or the target rule’s result in topological order; caller values in
crate::planning::execution_plan::DataOverlay override the reference.
Implementations§
Source§impl DataDefinition
impl DataDefinition
Sourcepub fn schema_type(&self) -> Option<&LemmaType>
pub fn schema_type(&self) -> Option<&LemmaType>
Schema type for value, type-declaration, and reference data; None for imports.
Sourcepub fn value(&self) -> Option<&LiteralValue>
pub fn value(&self) -> Option<&LiteralValue>
Returns the literal value when the data already holds one. A Reference’s
value is produced by the evaluator at runtime, so at plan-time it has no
value yet.
Sourcepub fn bound_value(&self) -> Option<&LiteralValue>
pub fn bound_value(&self) -> Option<&LiteralValue>
Literal explicitly bound in the spec (data x: literal) or supplied
by the caller via crate::planning::execution_plan::DataOverlay.
Not a suggestion; see Self::default_suggestion.
Sourcepub fn default_suggestion(&self) -> Option<LiteralValue>
pub fn default_suggestion(&self) -> Option<LiteralValue>
Suggestion from -> default ... on a type declaration or reference.
Surfaces in crate::planning::execution_plan::DataEntry::default for
prefill/UI; the evaluator applies it when the caller does not supply a value.
Sourcepub fn reference_target(&self) -> Option<&ReferenceTarget>
pub fn reference_target(&self) -> Option<&ReferenceTarget>
Returns the reference target when this data copies a value from another
data path or rule result; None otherwise.
Trait Implementations§
Source§impl Clone for DataDefinition
impl Clone for DataDefinition
Source§fn clone(&self) -> DataDefinition
fn clone(&self) -> DataDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more