Skip to main content

DataDefinition

Enum DataDefinition 

Source
pub enum DataDefinition {
    Value {
        value: LiteralValue,
        resolved_type: Arc<LemmaType>,
        origin: DataOrigin,
        source: Source,
    },
    TypeDeclaration {
        resolved_type: Arc<LemmaType>,
        declared_suggestion: Option<BoundValueKind>,
        declared_value: Option<BoundValueKind>,
        source: Source,
    },
    Import {
        row: Arc<RowInstance>,
        pin: Option<ImportEffectivePin>,
        candidates: BTreeMap<SpecIdentity, Arc<RowInstance>>,
        source: Source,
    },
    InstanceList {
        resolved_type: Arc<LemmaType>,
        origin: DataOrigin,
        source: Source,
    },
    Reference {
        target: ReferenceTarget,
        resolved_type: Arc<LemmaType>,
        local_constraints: Option<Vec<Constraint>>,
        local_suggestion: Option<BoundValueKind>,
        local_value: Option<BoundValueKind>,
        origin: DataOrigin,
        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 literal (spec default or with binding).

Fields

§resolved_type: Arc<LemmaType>
§origin: DataOrigin
§source: Source
§

TypeDeclaration

Type-only data: type known, value to be supplied (e.g. via run data). declared_suggestion carries the -> suggest ... payload for this binding or the suggestion inherited from the parent type chain, if any; value-promoting code uses it instead of re-deriving suggestions from TypeSpecification. The evaluator never commits a suggestion — unbound stays MissingData.

Fields

§resolved_type: Arc<LemmaType>
§declared_suggestion: Option<BoundValueKind>
§declared_value: Option<BoundValueKind>
§source: Source
§

Import

Import (uses): a spec instance named alias in this plan, a row over the imported spec’s template plan. Its bindings are the -> with / path-fill fields the declaring spec wrote; the imported data and rules are read through the template in the instance’s context.

When pin is None, row is the sole body. When pin is Some (-> effective), candidates holds every possible body and evaluation selects among them; row then equals an arbitrary candidate and must not be read without selection.

Fields

§pin: Option<ImportEffectivePin>

Planned path of the -> effective date when present.

§candidates: BTreeMap<SpecIdentity, Arc<RowInstance>>

Bound rows keyed by identity when pin is set; empty for static imports.

§source: Source
§

InstanceList

Instance list (data x: spec list). resolved_type is the list type. Rows written in the spec are instances of this plan under the list path (crate::planning::execution_plan::ExecutionPlan::instance_lists); evaluation lists them unless run data replaces the list.

Fields

§resolved_type: Arc<LemmaType>
§origin: DataOrigin
§source: Source
§

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 declared 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_suggestion carries any suggest <value> constraint from the reference’s -> ... tail. The reference-merge pass extracts it from the constraint list during type resolution. It is a UI hint only ([Self::suggestion] / show); the evaluator never commits it — unbound stays MissingData.

The reference itself is evaluated by copying the target’s value (data path) or the target rule’s result in topological order. Evaluate data for this path binds via resolved_type like a type declaration.

Fields

§resolved_type: Arc<LemmaType>
§local_constraints: Option<Vec<Constraint>>
§local_suggestion: Option<BoundValueKind>
§local_value: Option<BoundValueKind>
§origin: DataOrigin
§source: Source

Implementations§

Source§

impl DataDefinition

Source

pub fn is_bound(&self) -> bool

Whether a consumer bound this slot (uses -> with, path fill, or a row field written in a data list). Bound slots take no evaluation data.

Source

pub fn lemma_type(&self) -> Option<&LemmaType>

Declared lemma type for value, type-declaration, and reference data; None for imports.

Source

pub fn resolved_type_arc(&self) -> Option<&Arc<LemmaType>>

Shared Arc for the declared type; None for imports.

Source

pub fn schema_type(&self) -> Option<&LemmaType>

Alias for Self::lemma_type (historical name).

Source

pub fn value(&self) -> Option<LiteralValue>

Returns the literal value when the data already holds one, including -> with on a type declaration or reference. A data-target Reference’s copied value is produced by the evaluator at runtime, so at plan-time it has no value yet.

Source

pub fn source(&self) -> &Source

Returns the source location for this data.

Source

pub fn import_sole_row(&self) -> &Arc<RowInstance> ⓘ

The sole row of a static (pin is None) import.

Source

pub fn import_candidates(&self) -> &BTreeMap<SpecIdentity, Arc<RowInstance>>

Candidate rows of a dynamic import (pin is set).

Source

pub fn import_pin(&self) -> Option<&ImportEffectivePin>

Whether this import selects its body from a -> effective pin at evaluation.

Source

pub fn import_row_for(&self, identity: &SpecIdentity) -> &Arc<RowInstance> ⓘ

Row of a dynamic import for identity, or the sole static row when pin is None.

Trait Implementations§

Source§

impl Clone for DataDefinition

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DataDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.