(
&self,
other: &Box<dyn Value>,
group_op: &GroupComparisonOperator,
)
| 78 | } |
| 79 | |
| 80 | fn group_eq_op( |
| 81 | &self, |
| 82 | other: &Box<dyn Value>, |
| 83 | group_op: &GroupComparisonOperator, |
| 84 | ) -> Result<Box<dyn Value>, String> { |
| 85 | if other.is_array_of(|element_type| element_type.is_date()) { |
| 86 | let elements = &other.as_array().unwrap(); |
| 87 | let mut matches_count = 0; |
| 88 | for element in elements.iter() { |
| 89 | if self.timestamp == element.as_date().unwrap() { |
| 90 | matches_count += 1; |
| 91 | if GroupComparisonOperator::Any.eq(group_op) { |
| 92 | break; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | let result = match group_op { |
| 98 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 99 | GroupComparisonOperator::Any => matches_count > 0, |
| 100 | }; |
| 101 | |
| 102 | return Ok(Box::new(BoolValue::new(result))); |
| 103 | } |
| 104 | Err("Unexpected type to perform `=` with".to_string()) |
| 105 | } |
| 106 | |
| 107 | fn bang_eq_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 108 | if let Some(other_text) = other.as_any().downcast_ref::<DateValue>() { |
no test coverage detected