pub struct RuleResultValue {
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>>,
}Expand description
API value shared by flattened crate::evaluation::response::RuleResult,
ShowData.fill / suggestion, and explanation Data / Rule nodes.
When present: always 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.
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.
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 spec instance of more than one uses hop is not reconstructed yet.
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.