datex-core 0.0.12

The DATEX Core Rust implementation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::values::value_container::{ValueContainer, error::ValueError};
use core::{ops::Neg, result::Result};

impl Neg for ValueContainer {
    type Output = Result<ValueContainer, ValueError>;

    fn neg(self) -> Self::Output {
        match self {
            ValueContainer::Local(value) => (-value).map(ValueContainer::Local),
            ValueContainer::Shared(reference) => reference
                .with_collapsed_value_mut(|value| {
                    (-value.clone()).map(ValueContainer::Local)
                }),
        }
    }
}