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        Ok((&self.inner - &rhs.inner)?.into())
9    }
10}
11
12impl Sub for &Value {
13    type Output = Result<Value, ValueError>;
14    fn sub(self, rhs: &Value) -> Self::Output {
15        Value::sub(self.clone(), rhs.clone())
16    }
17}