pub enum DataDefinition {
Value {
value: LiteralValue,
source: Source,
},
TypeDeclaration {
resolved_type: LemmaType,
declared_default: Option<ValueKind>,
source: Source,
},
SpecRef {
spec: Arc<LemmaSpec>,
source: Source,
},
Reference {
target: ReferenceTarget,
resolved_type: LemmaType,
local_constraints: Option<Vec<Constraint>>,
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.
SpecRef
Spec reference data: holds the resolved spec.
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; the evaluator falls back to it
when the target value/rule is missing or vetoes for missing data so the
downstream sees the declared default instead of a missing-data veto.
The reference itself is evaluated by copying the target’s value (data path)
or the target rule’s result in topological order; with_data_values
entries for a referenced path override the reference with a literal.
Implementations§
Source§impl DataDefinition
impl DataDefinition
Sourcepub fn schema_type(&self) -> Option<&LemmaType>
pub fn schema_type(&self) -> Option<&LemmaType>
Returns the schema type for value, type-declaration, and reference data; None for spec references.
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 schema_default(&self) -> Option<LiteralValue>
pub fn schema_default(&self) -> Option<LiteralValue>
Schema-level default for this data: the value to surface in
[SpecSchema::data]’s default field.
Differs from Self::value: Value data already carries the literal
(a default that planning promoted to a value), so both return the
same thing for that variant. For Reference and TypeDeclaration the
schema-level default lives separately from the runtime value (the
reference’s copied target value, or the type-only data’s user-supplied
value); we synthesize the LiteralValue from the declared default and
the resolved_type here so callers don’t have to. SpecRef has no
schema default.
Sourcepub fn spec_arc(&self) -> Option<&Arc<LemmaSpec>>
pub fn spec_arc(&self) -> Option<&Arc<LemmaSpec>>
Returns the referenced spec Arc for spec reference data; None otherwise.
Sourcepub fn spec_ref(&self) -> Option<&str>
pub fn spec_ref(&self) -> Option<&str>
Returns the referenced spec name for spec reference data; None otherwise.
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataDefinition
impl Debug for DataDefinition
Source§impl<'de> Deserialize<'de> for DataDefinition
impl<'de> Deserialize<'de> for DataDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DataDefinition
impl PartialEq for DataDefinition
Source§impl Serialize for DataDefinition
impl Serialize for DataDefinition
impl Eq for DataDefinition
impl StructuralPartialEq for DataDefinition
Auto Trait Implementations§
impl Freeze for DataDefinition
impl RefUnwindSafe for DataDefinition
impl Send for DataDefinition
impl Sync for DataDefinition
impl Unpin for DataDefinition
impl UnsafeUnpin for DataDefinition
impl UnwindSafe for DataDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more