Skip to main content

datex_core/values/value/ops/
add.rs

1use core::ops::Add;
2
3use crate::values::{value::Value, value_container::error::ValueError};
4
5impl Add for &Value {
6    type Output = Result<Value, ValueError>;
7    fn add(self, rhs: &Value) -> Self::Output {
8        match (self, rhs) {
9            (Value::Core(lhs), Value::Core(rhs)) => {
10                (lhs + rhs).map(Value::Core)
11            }
12            (_, _) => todo!("Handle add for non-Core values"),
13        }
14    }
15}
16
17impl Add for Value {
18    type Output = Result<Value, ValueError>;
19    fn add(self, rhs: Value) -> Self::Output {
20        &self + &rhs
21    }
22}