lemma/
operation_result.rs

1use crate::semantic::LiteralValue;
2
3/// Result of an operation (evaluating a rule or expression)
4#[derive(Debug, Clone, PartialEq)]
5pub enum OperationResult {
6    /// Operation produced a value
7    Value(LiteralValue),
8    /// Operation was vetoed (valid result, no value)
9    Veto(Option<String>),
10}
11
12impl OperationResult {
13    /// Check if this is a vetoed result
14    pub fn is_vetoed(&self) -> bool {
15        matches!(self, OperationResult::Veto(_))
16    }
17
18    /// Get the value if present, None if vetoed
19    pub fn value(&self) -> Option<&LiteralValue> {
20        match self {
21            OperationResult::Value(v) => Some(v),
22            OperationResult::Veto(_) => None,
23        }
24    }
25
26    /// Get the veto message if vetoed, None otherwise
27    pub fn veto_message(&self) -> Option<&Option<String>> {
28        match self {
29            OperationResult::Veto(msg) => Some(msg),
30            OperationResult::Value(_) => None,
31        }
32    }
33}