pub enum DataValue {
Definition {
base: Option<ParentType>,
constraints: Option<Vec<Constraint>>,
from: Option<SpecRef>,
value: Option<Value>,
},
Import(SpecRef),
Reference {
target: Reference,
constraints: Option<Vec<Constraint>>,
},
}Expand description
Parse-time data value (before type resolution)
Variants§
Definition
Declares data: optional explicit parent type, optional constraints (-> ...),
optional from <spec> repository qualifier, and optional literal value.
Examples:
data x: 3.14→base: None,value: Some(Number)data x: number -> minimum 0→base: Some(Number),constraints: Some(...)data x: money from @lemma/std finance→base: Some(Custom("money")),from: Some(...)
Import(SpecRef)
Import from another spec (surface syntax is uses; alias is LemmaData::reference).
Reference
A value-copy reference to another data or rule, with optional additional constraints.
Two surface forms produce this variant:
- Dotted RHS in any position — e.g.
data license2: law.otherordata license2: law.other -> minimum 5. A dotted RHS is never a typedef name, so it unambiguously means “copy from this data or rule.” - Non-dotted RHS in a binding LHS — e.g.
data license.other: src. When the LHS has segments (a binding path into another spec) the RHS is read as a value-copy reference to a name in the enclosing spec, not as a typedef.
data x: someident (LHS without segments, RHS without dots) uses DataValue::Definition
with someident as the parent type name. See parser [crate::parsing::parser::Parser::parse_data_value].
The target is resolved during planning to either a [DataPath] or a [RulePath].
Implementations§
Source§impl DataValue
impl DataValue
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DataValue
impl<'de> Deserialize<'de> for DataValue
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>,
impl StructuralPartialEq for DataValue
Auto Trait Implementations§
impl Freeze for DataValue
impl RefUnwindSafe for DataValue
impl Send for DataValue
impl Sync for DataValue
impl Unpin for DataValue
impl UnsafeUnpin for DataValue
impl UnwindSafe for DataValue
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