pub struct LiteralValue {
pub value: ValueKind,
}Expand description
Runtime literal payload. Type lives on NormalForm.result_type / DataDefinition /
explicit computation parameters — not on the value.
Fields§
§value: ValueKindImplementations§
Source§impl LiteralValue
impl LiteralValue
pub fn text(s: impl Into<Arc<str>>) -> Self
pub fn number(n: RationalInteger) -> Self
pub fn number_from_decimal(decimal: Decimal) -> Self
pub fn measure(n: RationalInteger) -> Self
pub fn from_bool(b: bool) -> Self
pub fn from_datetime(dt: &DateTimeValue) -> Self
pub fn date(dt: SemanticDateTime) -> Self
pub fn time(t: SemanticTime) -> Self
pub fn ratio(r: RationalInteger) -> Self
pub fn ratio_from_decimal(r: Decimal) -> Self
pub fn range(left: TypedLiteral, right: TypedLiteral) -> Self
Sourcepub fn display_value(&self) -> String
pub fn display_value(&self) -> String
Display without an explicit type. Measure/ratio fall back to magnitude-only.
Sourcepub fn display_value_with_type(&self, lemma_type: &LemmaType) -> String
pub fn display_value_with_type(&self, lemma_type: &LemmaType) -> String
Display string given an explicit type (measure/ratio need unit identity).
Sourcepub fn display_value_with_scales(
&self,
lemma_type: &LemmaType,
runtime_scales: Option<&HashMap<String, RationalInteger>>,
) -> String
pub fn display_value_with_scales( &self, lemma_type: &LemmaType, runtime_scales: Option<&HashMap<String, RationalInteger>>, ) -> String
Display string given an explicit type and settled reference-scale factors.
Sourcepub fn magnitude_suggestion_for_decimal_prompt(
&self,
lemma_type: &LemmaType,
) -> Option<Decimal>
pub fn magnitude_suggestion_for_decimal_prompt( &self, lemma_type: &LemmaType, ) -> Option<Decimal>
Magnitude for decimal input prompts (API Decimal; format at call site).
Sourcepub fn measure_units(
&self,
lemma_type: &LemmaType,
) -> Option<BTreeMap<String, Decimal>>
pub fn measure_units( &self, lemma_type: &LemmaType, ) -> Option<BTreeMap<String, Decimal>>
Per-unit magnitudes when this literal is a measure with declared units.
Sourcepub fn ratio_units(
&self,
lemma_type: &LemmaType,
) -> Option<BTreeMap<String, Decimal>>
pub fn ratio_units( &self, lemma_type: &LemmaType, ) -> Option<BTreeMap<String, Decimal>>
Per-unit magnitudes when this literal is a ratio with declared units.
Sourcepub fn magnitude_in_unit(
&self,
lemma_type: &LemmaType,
unit: &str,
) -> Option<Decimal>
pub fn magnitude_in_unit( &self, lemma_type: &LemmaType, unit: &str, ) -> Option<Decimal>
Magnitude in a declared unit when this literal is measure or ratio.
Sourcepub fn duration_canonical_seconds(
&self,
lemma_type: &LemmaType,
) -> RationalInteger
pub fn duration_canonical_seconds( &self, lemma_type: &LemmaType, ) -> RationalInteger
Derive second from a duration measure’s canonical magnitude.
Sourcepub fn calendar_canonical_months(
&self,
lemma_type: &LemmaType,
) -> RationalInteger
pub fn calendar_canonical_months( &self, lemma_type: &LemmaType, ) -> RationalInteger
Derive month from a calendar measure’s canonical magnitude.
Trait Implementations§
Source§impl Clone for LiteralValue
impl Clone for LiteralValue
Source§impl Debug for LiteralValue
impl Debug for LiteralValue
Source§impl Display for LiteralValue
impl Display for LiteralValue
impl Eq for LiteralValue
Source§impl From<&LiteralValue> for LiteralValue
impl From<&LiteralValue> for LiteralValue
Source§fn from(literal: &DomainLiteralValue) -> Self
fn from(literal: &DomainLiteralValue) -> Self
Source§impl From<&TypedLiteral> for LiteralValue
impl From<&TypedLiteral> for LiteralValue
Source§fn from(typed: &TypedLiteral) -> Self
fn from(typed: &TypedLiteral) -> Self
Source§impl From<TypedLiteral> for LiteralValue
impl From<TypedLiteral> for LiteralValue
Source§fn from(typed: TypedLiteral) -> Self
fn from(typed: TypedLiteral) -> Self
Source§impl Hash for LiteralValue
impl Hash for LiteralValue
Source§impl PartialEq for LiteralValue
impl PartialEq for LiteralValue
impl StructuralPartialEq for LiteralValue
Auto Trait Implementations§
impl Forget for LiteralValue
impl Freeze for LiteralValuewhere
*const u8 is !null: Freeze,
PhantomData<u32>: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const TypedLiteral is !null: Freeze,
PhantomData<TypedLiteral>: Freeze,
PhantomData<PathSegment>: Freeze,
*const ArcInner<RowInstance> is !null: Freeze,
PhantomData<ArcInner<RowInstance>>: Freeze,
*const InstanceKey is !null: Freeze,
PhantomData<InstanceKey>: Freeze,
*const ArcInner<[TypedLiteral]> is !null: Freeze,
PhantomData<ArcInner<[TypedLiteral]>>: Freeze,
*const ArcInner<RowStore> is !null: Freeze,
PhantomData<ArcInner<RowStore>>: Freeze,
*const ArcInner<LemmaType> is !null: Freeze,
PhantomData<ArcInner<LemmaType>>: Freeze,
*const ArcInner<KeyIndex> is !null: Freeze,
PhantomData<ArcInner<KeyIndex>>: Freeze,
impl Move for LiteralValue
impl RefUnwindSafe for LiteralValue
impl Send for LiteralValue
impl Sync for LiteralValue
impl Unpin for LiteralValue
impl UnsafeUnpin for LiteralValuewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const TypedLiteral is !null: UnsafeUnpin,
PhantomData<TypedLiteral>: UnsafeUnpin,
PhantomData<PathSegment>: UnsafeUnpin,
*const ArcInner<RowInstance> is !null: UnsafeUnpin,
PhantomData<ArcInner<RowInstance>>: UnsafeUnpin,
*const InstanceKey is !null: UnsafeUnpin,
PhantomData<InstanceKey>: UnsafeUnpin,
*const ArcInner<[TypedLiteral]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[TypedLiteral]>>: UnsafeUnpin,
*const ArcInner<RowStore> is !null: UnsafeUnpin,
PhantomData<ArcInner<RowStore>>: UnsafeUnpin,
*const ArcInner<LemmaType> is !null: UnsafeUnpin,
PhantomData<ArcInner<LemmaType>>: UnsafeUnpin,
*const ArcInner<KeyIndex> is !null: UnsafeUnpin,
PhantomData<ArcInner<KeyIndex>>: UnsafeUnpin,
impl UnwindSafe for LiteralValuewhere
RawVecInner: UnwindSafe,
Arc<str>: UnwindSafe,
BoxRaw<TypedLiteral>: UnwindSafe,
Arc<RowInstance>: UnwindSafe,
BoxRaw<InstanceKey>: UnwindSafe,
Arc<[TypedLiteral]>: UnwindSafe,
Arc<RowStore>: UnwindSafe,
Arc<LemmaType>: UnwindSafe,
Arc<KeyIndex>: UnwindSafe,
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.