pub struct RuleResultValue {
pub display: Option<String>,
pub measure: Option<BTreeMap<String, String>>,
pub ratio: Option<BTreeMap<String, String>>,
pub number: Option<String>,
pub boolean: Option<bool>,
pub text: Option<String>,
pub date: Option<SemanticDateTime>,
pub time: Option<SemanticTime>,
pub calendar: Option<CalendarResult>,
pub range: Option<Box<RangeResult>>,
}Expand description
API value shared by flattened crate::evaluation::response::RuleResult,
ShowData.prefilled, and ShowData.suggestion.
When present: always display (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§
§display: Option<String>Engine-rendered string for UI (LiteralValue::display_value). Present whenever
this value is present, including range endpoints.
measure: Option<BTreeMap<String, String>>§ratio: Option<BTreeMap<String, String>>§number: Option<String>§boolean: Option<bool>§text: Option<String>§date: Option<SemanticDateTime>§time: Option<SemanticTime>§calendar: Option<CalendarResult>§range: Option<Box<RangeResult>>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).
Trait Implementations§
Source§impl Clone for RuleResultValue
impl Clone for RuleResultValue
Source§fn clone(&self) -> RuleResultValue
fn clone(&self) -> RuleResultValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RuleResultValue
impl Debug for RuleResultValue
Source§impl Default for RuleResultValue
impl Default for RuleResultValue
Source§fn default() -> RuleResultValue
fn default() -> RuleResultValue
Returns the “default value” for a type. Read more
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for RuleResultValue
impl Display for RuleResultValue
impl Eq for RuleResultValue
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.