pub enum DataDefinition {
Value {
value: LiteralValue,
source: Source,
},
TypeDeclaration {
resolved_type: LemmaType,
declared_default: Option<ValueKind>,
source: Source,
},
Import {
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.
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 crate::planning::ExecutionPlan::with_defaults
before evaluation (or remains a schema suggestion when callers use
[Engine::run_plan_without_defaults]).
The reference itself is evaluated by copying the target’s value (data path)
or the target rule’s result in topological order; set_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>
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 substituted
by the caller via set_data_values as DataDefinition::Value.
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; omitted from Self::bound_value until applied via
crate::planning::ExecutionPlan::with_defaults.
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 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>,
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<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