pub enum ValueKind {
Number(RationalInteger),
Measure(RationalInteger),
UnscaledMeasure {
magnitude: RationalInteger,
unit: Arc<str>,
},
Text(Arc<str>),
Date(SemanticDateTime),
Time(SemanticTime),
Boolean(bool),
Ratio(RationalInteger),
Range(Box<TypedLiteral>, Box<TypedLiteral>),
Spec(SpecValue),
List(ListValue),
}Expand description
Value payload (shape of a literal).
Scalar variants are type-free: type lives on NormalForm.result_type /
DataDefinition. The ValueKind::Range arm is the exception — each
endpoint keeps a TypedLiteral so a mixed-unit range (10 eur...20 usd)
retains both written units.
Variants§
Number(RationalInteger)
Measure(RationalInteger)
Measure: magnitude in canonical (base-unit) space.
At bind time the user-facing value is multiplied by the unit’s scale to produce
the stored magnitude; API unit maps divide back. Unit/signature identity
comes from the node/DataDefinition type via LemmaType::measure_runtime_signature.
UnscaledMeasure
Measure written in a reference-scaled unit. Lives only in stored values
(literal leaves, data slots, definitions, bindings). A cell result never
holds one: the owning leaf settles it to ValueKind::Measure first.
Text(Arc<str>)
Date(SemanticDateTime)
Time(SemanticTime)
Boolean(bool)
Ratio(RationalInteger)
Ratio: canonical magnitude. Display unit comes from the node/DataDefinition type.
Range(Box<TypedLiteral>, Box<TypedLiteral>)
Range endpoints carry their own type (and written unit for measure/ratio).
Spec(SpecValue)
A spec instance: a uses path in the consumer plan, or one row of an instance list.
List(ListValue)
Ordered rows of one type. Each row keeps its own type (written unit for measures).
Implementations§
Source§impl ValueKind
impl ValueKind
Sourcepub fn as_decimal_magnitude(&self) -> Result<Decimal, String>
pub fn as_decimal_magnitude(&self) -> Result<Decimal, String>
Decimal magnitude for numeric variants (number, measure, ratio).
Sourcepub fn structural_byte_size(&self) -> usize
pub fn structural_byte_size(&self) -> usize
Cheap structural byte-size estimate (no formatting, no rational→decimal).
Used by resource-limit checks where the exact string length is not required — only an upper-bound within a constant factor.
Sourcepub fn has_unscaled_measure(&self) -> bool
pub fn has_unscaled_measure(&self) -> bool
Whether this stored value still contains a reference-scaled measure.
Trait Implementations§
impl Eq for ValueKind
Source§impl From<&ValueKind> for ValueKind
impl From<&ValueKind> for ValueKind
Source§fn from(value: &DomainValueKind) -> Self
fn from(value: &DomainValueKind) -> Self
impl StructuralPartialEq for ValueKind
Auto Trait Implementations§
impl Forget for ValueKind
impl Freeze for ValueKind
impl RefUnwindSafe for ValueKind
impl Send for ValueKind
impl Sync for ValueKind
impl Unpin for ValueKind
impl UnsafeUnpin for ValueKind
impl UnwindSafe for ValueKind
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.