pub enum DataValue {
Definition {
base: Option<ParentType>,
constraints: Option<Vec<Constraint>>,
value: Option<Value>,
list: Option<InstanceListBody>,
},
Import {
spec_ref: SpecRef,
bindings: Vec<UsesBinding>,
effective_ref: Option<Reference>,
},
ImportList {
spec_ref: SpecRef,
list: InstanceListBody,
},
}Expand description
Parse-time data value (before type resolution)
Variants§
Definition
Declares data: optional explicit parent type, optional constraints (-> ...),
optional literal value, and optional instance-list body (-> key / -> with rows).
Examples:
data x: 3.14→base: None,value: Some(Number)data x: number -> minimum 0→base: Some(Number),constraints: Some(...)data x: finance.money→base: Some(Qualified { spec_alias: "finance", inner: Custom("money") })data staff: employee list -> with name: "Ada"→base: Some(List { … }),list: Some(…)
Value-list rows stay in constraints (money list -> with 89 eur). Instance-list
-> key and field / named-instance rows live in list.
Fields
base: Option<ParentType>Import
Import from another spec (surface syntax is uses; alias is LemmaData::reference).
effective_ref is -> effective <ref> on the uses block; mutually exclusive with
a trailing literal pin on SpecRef::effective.
ImportList
uses names one spec. A list after that target is a parse error, so planning
never sees this variant. It stays so matches stay exhaustive with the published type.
Implementations§
Source§impl DataValue
impl DataValue
pub fn import(spec_ref: SpecRef) -> Self
Sourcepub fn is_definition_literal_only(&self) -> bool
pub fn is_definition_literal_only(&self) -> bool
Whether this is only a literal RHS (data x: 3.14), valid as a binding value.
Sourcepub fn definition_needs_type_resolution(&self) -> bool
pub fn definition_needs_type_resolution(&self) -> bool
Whether planning must resolve this LemmaData row through the type resolver / named types.
Spec-element instance lists (list: Some or empty spec list) are planned via
add_instance_list, not the named-type registry.
Sourcepub fn uses_spec_ref(&self) -> Option<&SpecRef>
pub fn uses_spec_ref(&self) -> Option<&SpecRef>
Spec named by a uses alias.
Types and units read through the alias the same way.