pub struct BoundValueKind {
pub value: ValueKind,
pub unit: Option<Arc<str>>,
pub instance_factors: Option<Arc<BTreeMap<String, RationalInteger>>>,
}Expand description
Canonical suggestion/fill value plus the written measure unit when one was declared.
unit is the unit from -> suggest 100 inr / -> with 5 eur; Show
display stamps it so the one-liner matches the written unit, not the type’s first unit.
Shared via Arc so value-table clones bump a refcount instead of allocating.
For ranges this stays None; each endpoint carries its own unit on its type.
instance_factors are the settled dynamic unit factors of the instance this value
was read from (uses alias or list row). Same-family arithmetic keeps only factors
both sides agree on; a family change drops them.
Fields§
§value: ValueKind§unit: Option<Arc<str>>§instance_factors: Option<Arc<BTreeMap<String, RationalInteger>>>Implementations§
Source§impl BoundValueKind
impl BoundValueKind
pub fn unbound(value: ValueKind) -> Self
pub fn with_binding(value: ValueKind, unit: Option<Arc<str>>) -> Self
pub fn with_instance_factors( value: ValueKind, unit: Option<Arc<str>>, instance_factors: Option<Arc<BTreeMap<String, RationalInteger>>>, ) -> Self
pub fn to_literal(&self) -> LiteralValue
Sourcepub fn agree_or_left_binding(
left: Option<&Arc<str>>,
right: Option<&Arc<str>>,
) -> Option<Arc<str>>
pub fn agree_or_left_binding( left: Option<&Arc<str>>, right: Option<&Arc<str>>, ) -> Option<Arc<str>>
Written-unit agreement for ± on same-family measure/ratio: equal keep; one Some keep that; conflict → left wins.
Sourcepub fn agree_instance_factors(
left: Option<&Arc<BTreeMap<String, RationalInteger>>>,
right: Option<&Arc<BTreeMap<String, RationalInteger>>>,
) -> Option<Arc<BTreeMap<String, RationalInteger>>>
pub fn agree_instance_factors( left: Option<&Arc<BTreeMap<String, RationalInteger>>>, right: Option<&Arc<BTreeMap<String, RationalInteger>>>, ) -> Option<Arc<BTreeMap<String, RationalInteger>>>
Agreed instance factors for same-family arithmetic: units both sides carry with equal factors stay; either side missing a map means no carried instance agreement (local / plan-scoped values rely on runtime scales, not a one-sided carry).
Sourcepub fn binding_with_agreed_factors(
unit: Option<Arc<str>>,
factors: &Option<Arc<BTreeMap<String, RationalInteger>>>,
) -> Option<Arc<str>>
pub fn binding_with_agreed_factors( unit: Option<Arc<str>>, factors: &Option<Arc<BTreeMap<String, RationalInteger>>>, ) -> Option<Arc<str>>
Keep a written unit only when agreed instance factors still know its factor. When there is no instance map, leave the binding for plan-scoped runtime scales.
Trait Implementations§
Source§impl Clone for BoundValueKind
impl Clone for BoundValueKind
Source§impl Debug for BoundValueKind
impl Debug for BoundValueKind
impl Eq for BoundValueKind
Source§impl Hash for BoundValueKind
impl Hash for BoundValueKind
Source§impl PartialEq for BoundValueKind
impl PartialEq for BoundValueKind
impl StructuralPartialEq for BoundValueKind
Auto Trait Implementations§
impl Forget for BoundValueKind
impl Freeze for BoundValueKind
impl Move for BoundValueKind
impl RefUnwindSafe for BoundValueKind
impl Send for BoundValueKind
impl Sync for BoundValueKind
impl Unpin for BoundValueKind
impl UnsafeUnpin for BoundValueKind
impl UnwindSafe for BoundValueKind
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.