Skip to main content

DataDefinition

Enum DataDefinition 

Source
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.

Fields

§source: Source
§

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.

Fields

§resolved_type: LemmaType
§declared_default: Option<ValueKind>
§source: Source
§

SpecRef

Spec reference data: holds the resolved spec.

Fields

§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 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.

Fields

§resolved_type: LemmaType
§local_constraints: Option<Vec<Constraint>>
§local_default: Option<ValueKind>
§source: Source

Implementations§

Source§

impl DataDefinition

Source

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

Returns the schema type for value, type-declaration, and reference data; None for spec references.

Source

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.

Source

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.

Source

pub fn source(&self) -> &Source

Returns the source location for this data.

Source

pub fn spec_arc(&self) -> Option<&Arc<LemmaSpec>>

Returns the referenced spec Arc for spec reference data; None otherwise.

Source

pub fn spec_ref(&self) -> Option<&str>

Returns the referenced spec name for spec reference data; None otherwise.

Source

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

Source§

fn clone(&self) -> DataDefinition

Returns a duplicate of the value. Read more
1.0.0 · 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
Source§

impl<'de> Deserialize<'de> for DataDefinition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DataDefinition

Source§

fn eq(&self, other: &DataDefinition) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DataDefinition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for DataDefinition

Source§

impl StructuralPartialEq for DataDefinition

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,