pub struct RuleResultValue {Show 16 fields
pub result: Option<String>,
pub measure: Option<BTreeMap<String, Decimal>>,
pub ratio: Option<BTreeMap<String, Decimal>>,
pub number: Option<Decimal>,
pub boolean: Option<bool>,
pub text: Option<String>,
pub date: Option<SemanticDateTime>,
pub time: Option<SemanticTime>,
pub calendar: Option<CalendarResult>,
pub unit: Option<String>,
pub range: Option<Box<RangeResult>>,
pub spec: Option<Box<SpecResult>>,
pub row: Option<RowReference>,
pub list: Option<Vec<RuleResultValue>>,
pub fields: Option<IndexMap<String, RuleResultValue>>,
pub reference: Option<String>,
}Expand description
API value shared by flattened crate::evaluation::response::RuleResult,
ShowData.value / suggestion, and explanation Data / Rule nodes.
When present: result (from LiteralValue::display_value), plus exactly
one typed field for a non-range value; range is set instead for a range value, and
every other typed field stays None. A list row carries row in rule results and
in RowResult members; in explanation nodes it carries result only. The one
value without result is an instance list in Show: the list carries list only and
each source row fields only, in row order.
Fields§
§result: Option<String>Engine-rendered string for UI (LiteralValue::display_value). Present whenever
this value is present, including range endpoints.
measure: Option<BTreeMap<String, Decimal>>§ratio: Option<BTreeMap<String, Decimal>>§number: Option<Decimal>§boolean: Option<bool>§text: Option<String>§date: Option<SemanticDateTime>§time: Option<SemanticTime>§calendar: Option<CalendarResult>§unit: Option<String>Written unit for a measure or ratio value (including range endpoints).
range: Option<Box<RangeResult>>§spec: Option<Box<SpecResult>>Set when the value is a spec instance. data holds one evaluated entry per
data slot of that instance, keyed relative to that spec.
row: Option<RowReference>Set when the value is a row of an instance list.
list: Option<Vec<RuleResultValue>>§fields: Option<IndexMap<String, RuleResultValue>>Set on a source row of an instance list in Show: the fields the row sets, keyed relative to the row spec, in the order the row writes them.
reference: Option<String>Show only: on a source-row field whose value is a reference; the input key of the referenced data in the spec declaring the list.
Implementations§
Source§impl RuleResultValue
impl RuleResultValue
Sourcepub fn to_literal(&self, rule_type: &LemmaType) -> LiteralValue
pub fn to_literal(&self, rule_type: &LemmaType) -> LiteralValue
Reconstruct the LiteralValue from this API value’s fields.
Panics if the fields cannot reconstruct a literal, or if a range endpoint is itself a range (ranges do not nest; enforced here, not by convention). A list row is not rebuilt: its value is its bindings, which the API value does not carry. Read a row through its fields instead.
Trait Implementations§
Source§impl Clone for RuleResultValue
impl Clone for RuleResultValue
Source§impl Debug for RuleResultValue
impl Debug for RuleResultValue
Source§impl Default for RuleResultValue
impl Default for RuleResultValue
Source§impl<'de> Deserialize<'de> for RuleResultValue
impl<'de> Deserialize<'de> for RuleResultValue
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>,
Source§impl Display for RuleResultValue
impl Display for RuleResultValue
impl Eq for RuleResultValue
Source§impl From<&RuleResultValue> for RuleResultValue
impl From<&RuleResultValue> for RuleResultValue
Source§fn from(value: &DomainRuleResultValue) -> Self
fn from(value: &DomainRuleResultValue) -> Self
Source§impl PartialEq for RuleResultValue
impl PartialEq for RuleResultValue
Source§impl Serialize for RuleResultValue
impl Serialize for RuleResultValue
impl StructuralPartialEq for RuleResultValue
Auto Trait Implementations§
impl Freeze for RuleResultValue
impl RefUnwindSafe for RuleResultValue
impl Send for RuleResultValue
impl Sync for RuleResultValue
impl Unpin for RuleResultValue
impl UnsafeUnpin for RuleResultValue
impl UnwindSafe for RuleResultValue
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.