(&self, other: &Box<dyn Value>)
| 95 | } |
| 96 | |
| 97 | fn caret_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 98 | if let Some(other_int) = other.as_any().downcast_ref::<IntValue>() { |
| 99 | if other_int.value < 0 { |
| 100 | return Err("Caret right side hand can't be negative value".to_string()); |
| 101 | } |
| 102 | let value = self.value.pow(other_int.value as u32); |
| 103 | return Ok(Box::new(IntValue::new(value))); |
| 104 | } |
| 105 | Err("Unexpected type to perform `^` with".to_string()) |
| 106 | } |
| 107 | |
| 108 | fn or_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 109 | if let Some(other_int) = other.as_any().downcast_ref::<IntValue>() { |
no test coverage detected