Skip to main content

datex_core/values/value/ops/
sub.rs

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