| 95 | } |
| 96 | |
| 97 | fn add_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 98 | if let Some(other_interval) = other.as_any().downcast_ref::<IntervalValue>() { |
| 99 | let interval = self.interval.add(&other_interval.interval)?; |
| 100 | return Ok(Box::new(IntervalValue::new(interval))); |
| 101 | } |
| 102 | Err("Unexpected type to perform `+` with".to_string()) |
| 103 | } |
| 104 | |
| 105 | fn sub_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 106 | if let Some(other_interval) = other.as_any().downcast_ref::<IntervalValue>() { |